On 22/11/2020 10:21, Sergey Organov wrote: > Junio C Hamano <gitster@xxxxxxxxx> writes: > >> Sergey Organov <sorganov@xxxxxxxxx> writes: >> >>> To me "not on a branch [tip]" is also confusing, as in fact you are, as >>> is easily seen after you perform a few commits, and now HEAD points >>> directly to the tip of the branch (that has no other references). >> Aren't you confused about what "on a branch" means? > I believe I'm not. Isn't this one of those "implementation detail" viewpoint arguments, combined with some incompleteness in various places. >From a naive english user perspective , 'on' a branch can also mean anywhere along a branch and not just at the tip. Being at a commit along a branch can be tricky to appreciate (that on/at distinction isn't immediately obvious..) > >> After either of these two operations, your HEAD may point at the >> same commit, but the former is on a branch (the master branch), and >> the latter is not. >> >> git checkout master >> git checkout master^0 >> >> The difference between these two states does *NOT* come from which >> commit HEAD points at. > Sure. >From an implementation perspective one can go two ways, and we tell the user which way we went, even though, ultimately, we look at the same commit. Though, for an unborn branch we don't have a null commit value (c.f. empty tree) to help in being 'detached at nowhere'. > >> The difference comes from what happens when you make a new commit >> starting from that state. The former (i.e. you are on a branch) >> grows the branch. > Sure. > >> The latter (i.e. you are not on a branch) does not grow any branch. > That's one way of looking at it, resulting in this "detached HEAD" > thingy that is too technical for the git user proper, I think. Moreover, > it immediately raises the question: if it doesn't grow any branch, /what/ > does it grow? > > Another way of describing it, that I prefer, is that you /are/ on an > /unnamed/ branch and new commits grow this particular /unnamed/ branch. > No need not only for "detached", but even for "HEAD" to be known to the > user to get the idea, I think. I don't think we can start like this and continue with a commit on top of the orphaned 'unnamed' branch. (Not tried it though..) > >> This is an unrelated trivia, but did anybody know that we were >> pretty much on the detached HEAD all the time for more than a month >> of early life of Git, until cad88fdf (git-init-db: set up the full >> default environment, 2005-05-30)? > I was not aware, and it seems that in my terminology it'd sound: "Git > didn't have named branches until cad88fdf". > > -- Sergey