Hi all, On 16/11/2022 11:55, Konstantin Khomoutov wrote: >> I thought the main difference between git and hg, is (besides the >> command syntax) the way branches are considered, a git branch is similar >> to a bookmark, while a named branch has no equivalent in git. > This is true, but the terminology, as usually, is open to interpretaton > and allows some wiggle room for mind ;-) > When some text says Git branches are like bookmarks, and that Hg's named > branches have no equivalent in Git, that is true, but the meaning of this is > that 1) Git commits do not embed the name of the branch which was checked out > when the commit has been recorded; 2) Branches do not have any metadata except > the current name of the branch; 3) A brach records its tip commit; when a new > commit is recorded on a branch, this record is overwritten. > > I find it easier to undertand if you think of a Git branch as
I visualise it similar to a speech bubble or label that is attached to / moved along with, the tip commit. Perhaps as a 'push-pin', if you will, that marks your progress in generating the sequence of commits in the 'graph'. And also if you merge a feature branch into a main branch you, just like a push-pin on a road map, lose the sense of the route you took to get there. You just know where that label *is*, rather than where it has been. > a text file (and > in the reference Git implementation a branch _is_ a text file) which contains > the cryptographic hash of the commit it points at. > When you record a new commit, the file is rewritten with the new hash. > When you rename a branch, the file is renamed. > You see, we can say it looks like a bookmark to a commit. > while 100% true, sometimes folks don't see the implementation view, hence the shift to an analogy, even though analogies can lead to other misunderstandings... As for the 'Frenchness' of "remote tracking branches" (local branches de tracking de remote ;-), they can be really confusing, along with the feeling that you must have a personal local branch to match an 'rtb'. As rtb's are local, their tip is just one of the push-pin labels, so you don't need a second push-pin at the same commit with a local name just to reference it. That took me a long while (years) to appreciate. I hope the extra comparison explanation is of help. Philip -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/925711eb-bacb-9f72-88a6-f47214aedf92%40iee.email.