GIT: How to unambiguously reference current HEAD when having a branch called HEAD?
Even though "HEAD" is definitely a poor choice for the name of a Git branch, it is still a valid branch name. If you happen to have branch named "HEAD", is there a way how to unambiguously refer to the actual HEAD symbolic reference? The branch can be referenced as refs/heads/HEAD , but what about the HEAD itself? Using just HEAD results in an refname 'HEAD' is ambiguous error anywhere where a <commit> is passed as an argument. According to gitrevisions , if both HEAD and refs/heads/HEAD exist, the selected revision is HEAD (i.e., not the branch named HEAD ). This is in fact the correct answer