-1

I have seen many git commands with syntax like:- <branch_name>:<branch_name> like git push origin (<branch_name>:<branch_name>). What exactly is the meaning of : here (why 2 times branch name)? Also, I want to know the difference between git push origin <branch_name> and git push origin <branch_name>:<branch_name>

zcoder
  • 42
  • 1
  • 2
  • 7
  • 1
    Related, and I think you could find your answer here: [git Parameters: Colon vs. Forward Slash](https://stackoverflow.com/q/18085344/4518341) – wjandrea Aug 13 '19 at 04:02
  • The branch on the local repo can have a different name than the branch on the remote. The syntax is `git push :` – William Pursell Aug 13 '19 at 04:03

1 Answers1

2

With colon notation, a soure and a destination can be defined (<source>:<destination>), to

Specify what destination ref to update with what source object.

See the git push documentation about refspecs and the answers to this question

kowsky
  • 12,647
  • 2
  • 28
  • 41