4 ms·
I forgot that HEAD doesn't point to tags! I guess it makes some semantic sense - tags are just labels, and shouldn't "carry" anything with them if they move. G
by happytoexplain 3y ago
I forgot that HEAD doesn't point to tags! I guess it makes some semantic sense - tags are just labels, and shouldn't "carry" anything with them if they move.
Great writeup. Technically "current branch" is easily defined: It's the branch (not commit or tag) HEAD points to, if any. "The last thing I checked out" is really just the last identifier you passed to 'git checkout', not what that resolved to and actually got checked out, or any commit-ish that HEAD has been pointed to in the meantime by other commands. "What's shown on my git prompt" could be any silly thing, since that's not git. However, colloquially (and even sometimes in the Git documentation itself!), "current branch" can mean other things, as the author enumerates, and it would be unrealistic to ignore that.
One note: It's silly that git prompts seem to choose an arbitrary tag to show when there's multiple - they should show all of them or none of them. However, the author says that 'git status' does the same thing, but for me (git 2.44.0), it does not report any tags, which makes sense to me (reporting all tags along with the SHA would also make sense).