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

If merging that is really fast forwarding creates new commit [Was: Re: how to show log for only one branch]

From
LYLiu Yubao <yubao.liu@gmail.com>
Date
Nov 6, 2006, 13:00 UTC
Message-ID
<454F31D7.1030202@gmail.com>
In-Reply-To
<7vk629f6is.fsf@assigned-by-dhcp.cox.net>

Thanks to Junio for his patient explanation about branches in git, I find there is a subtle difference between GIT and regular VCS that can be easily neglected by newbies.

I realize that git is a *content tracker*, it only creates commit object when the corresponding tree is really modified, git records content merging but not usual merging operation, that's why git is called a content tracker. This explains why a merging that is really a fast forwarding doesn't create any new commit.

This feature is different from many regular VCS like CVS and Subversion and confuses newbies that come from them: mainline doesn't make sense too much, 'git log' shows many logs from other branches. In git, a branch is almost a tag, you can't get the *track* of a branch(It's a pity reflog is only for local purpose). I am used to one-trunk-and-more-side-branches way, every branches are isolated clearly, git makes me very confused at the beginning.

Then, what bad *logical* problem will happen if a merging that is really a fast forwarding creates a new commit?

If we throw away all compatibility, efficiency, memory and disk consumption problems, (1) we can get the track of a branch without reflog because HEAD^1 is always the tip of target branch(or working branch usually) before merging.

(2) with the track, branch mechanism in git is possibly easier to understand, especially for newbies from CVS or Subversion, I really like git's light weight, simple but powerful design and great efficiency, but I am really surprised that 'git log' shows logs from other branches and a side branch can become part of main line suddenly.

A revision graph represents fast forwarding style merging like this:
             (fast forwarding)
  ---- a ............ * ------> master
        \            /
         b----------c -----> test         (three commits with three trees)
can be changed to:
  ---- a (tree_1) ----------- d (tree_3) ------> master
        \                    /
         b (tree_2) ------- c (tree_3) ----> test
(four commits with three trees, it's normal as more than one way can reach 
Rome :-)

I don't think I am smarter than any people in this mailing list, in fact I am confused very much by GIT's branches at the beginning. There must be many problems I haven't realized, I am very curious about them, any

Previous: Jakub NarebskiNext: Rocco Rutte
Message 7 of 35 in “how to show log for only one branch”
  1. Liu YubaoNov 6, 2006
  2. Junio C HamanoNov 6, 2006
  3. Liu YubaoNov 6, 2006
  4. Junio C HamanoNov 6, 2006
  5. Liu YubaoNov 7, 2006
  6. Jakub NarebskiNov 7, 2006
  7. If merging that is really fast forwarding creates new commit [Was: Re: how to show log for only one branch]Liu Yubao, Nov 6, 2006
  8. Rocco RutteNov 6, 2006
  9. Liu YubaoNov 7, 2006
  10. Andreas EricssonNov 6, 2006
  11. Liu YubaoNov 7, 2006
  12. Andy WhitcroftNov 7, 2006
  13. Liu YubaoNov 7, 2006
  14. Jakub NarebskiNov 7, 2006
  15. Linus TorvaldsNov 6, 2006
  16. Martin LanghoffNov 6, 2006
  17. Linus TorvaldsNov 6, 2006
  18. Liu YubaoNov 7, 2006
  19. Linus TorvaldsNov 7, 2006
  20. Junio C HamanoNov 7, 2006
  21. Eran TromerNov 7, 2006
  22. Liu YubaoNov 7, 2006
  23. Andy WhitcroftNov 7, 2006
  24. Liu YubaoNov 7, 2006
  25. Andy WhitcroftNov 7, 2006
  26. Linus TorvaldsNov 7, 2006
  27. Jakub NarebskiNov 7, 2006
  28. Junio C HamanoNov 7, 2006
  29. Planned new release of git [was: Re: If merging that is really fast forwarding creates new commit]Jakub Narebski, Nov 7, 2006
  30. Linus TorvaldsNov 7, 2006
  31. Junio C HamanoNov 7, 2006
  32. Junio C HamanoNov 7, 2006
  33. Jakub NarebskiNov 6, 2006
  34. Liu YubaoNov 7, 2006
  35. Jakub NarebskiNov 7, 2006

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.