which branch is specified in these git push commands

18 views Asked by At

what is the difference between :

git push origin HEAD: <name-of-remote-branch> 
git push origin CURRENT_BRANCH_NAME

Is CURRENT_BRANCH_NAME the name of my local branch or the remote branch ?

1

There are 1 answers

0
Kache On

From git help push:

The format of a <refspec> ... [is] the source object <src>, followed by a colon :, followed by the destination ref <dst>.

Then:

missing :<dst> means to update the same ref as the <src>

i.e. git will interpret git push origin CURRENT_BRANCH_NAME as git push origin CURRENT_BRANCH_NAME:CURRENT_BRANCH_NAME, assuming your git config is relatively standard.