git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git fetch,git merge and git rebase

From
NKNeal Kreitzinger <nkreitzinger@gmail.com>
Date
Feb 10, 2011, 20:00 UTC
Message-ID
<4D5443D1.9000904@gmail.com>
In-Reply-To
<1297315789338-6010561.post@n2.nabble.com>
On 2/9/2011 11:29 PM, Akash wrote:
Show 11 quoted lines
>
> Hi,
>
> I am new to git .Can someone explain in simple terms what git fetch,git
> merge and git rebase do?..I tried googling but was very confused after going
> thro it.
>
> Also, can someone prescribe a link which explains git in detail right from
> scratch.
>
>

git fetch: retrieve the latest version of a branch and store it in the /remotes/* "remote tracking branches" of your local repo. you can view these branches with "git branch -a". Once you have that local copy, you can merge it into other branches, checkout objects from it, and run diffs against it. You are not supposed to EVER make commits on a remote/* branch. its sole purpose in life is to maintain an image the the corresponding branchs that its tracking in the remote repo. you update that image by performing git fetch. see man-page for details.

git merge: merges branch(s) into your current branch. see man-page for details. lots and lots of details...

git rebase: takes all the local commits you've made on an old history and rewrites them on-top of the new history. it makes it look like you did your work based on the new history instead of the old history. it keeps your history 'linear' instead of having all these merge DAG's in your history like git-merge produces. see man page for details. lots and lots of details are not easy to understand at first...

hope this helps.

v/r, neal

Previous: Alexey ShumkinNext: Neal Kreitzinger
Message 6 of 11 in “git fetch,git merge and git rebase”
  1. AkashFeb 10, 2011
  2. Alexey ShumkinFeb 10, 2011
  3. Jonathan NiederFeb 10, 2011
  4. AkashFeb 11, 2011
  5. Alexey ShumkinFeb 10, 2011
  6. Neal KreitzingerFeb 10, 2011
  7. Neal KreitzingerFeb 10, 2011
  8. Jeff KingFeb 10, 2011
  9. AkashFeb 11, 2011
  10. Felipe ContrerasFeb 11, 2011
  11. Neal KreitzingerFeb 11, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.