Although @ can be used to indicate HEAD , you first need @ parse as ref. The syntax for git push takes refspec, and in this context, @ is given two different values, only one of which is ref.
The syntax for refspec in git push is [+]<src>[:<dst>] . + is optional. :<dst> is optional if it can be resolved from <src> .
git push origin HEAD works because HEAD considered as a very special case: HEAD usually a symbolic ref for a particular branch, and git push allows symbolic links and selects <dst> to the branch name.
You can also have, for example, git symbolic-ref MYMASTER refs/heads/master , and then git push origin MYMASTER .
git push origin HEAD~0 fails because it translates to git push origin HEAD~0:HEAD~0 , and the remote refname HEAD~0 invalid, although HEAD~0 will always indicate the same as HEAD .
git push origin @ fails because it translates to git push origin @:@ , and the remote refname @ not valid, although @ will necessarily indicate the same commit as HEAD .
git push origin @:HEAD will almost work if you have a remote branch named HEAD . This is not a special case when refspec is just HEAD , so it does not allow HEAD based on any character ref.
git push origin @:master works.
source share