Reputation: 531
Situation
Please help me in understanding the correct git push syntax as well as its meaning
Upvotes: 1
Views: 1495
Reputation: 97996
The technical description for this syntax is in the Git manual under "The Refspec" and the argument description of git push
, but the short version is that there are two common formats:
source:destination
, e.g. git push origin B:D
means "source is the local branch B
; destination is the remote branch D
".source
and destination
having the same name, e.g. git push origin B
is the same as git push origin B:B
, and means "source is the local branch B
; destination is the remote branch B
".Specifying B/D
would look for a branch with that name, e.g. some projects have naming conventions like "username/task-number"). However, you may be confusing it with "remote tracking branches", which take the form "remote-name/remote-branch-name", such as "origin/D"; you wouldn't normally be using those in a git push
command.
Upvotes: 5