Difference between git push origin prod AND git push origin prod:refs/heads/prod
When I create a new branch and then want to push it remotely, I can do:
git push origin prod
Git merge strategy Difference Between Creating A Local Branch With And Without '-b' How to checkout .git Update multiple installations of WordPress with Git Error when syncing with Github for Mac app Diagnosis of git fetch/pull error
git push origin prod:refs/heads/prod
What is the difference ?
One Solution collect form web for “Difference between git push origin prod AND git push origin prod:refs/heads/prod”
On vanilla configurations, there would be no difference.
However, remotes can be configured with custom push branch specifications in .git/config. In that case, specifying the explicit ref name on the server end like
local_ref_name:remote_ref_name overrides the configured mappings.
If you had just added a new remote, and wanted to push for the first time, you would need to at least specify the branch to push. In that case
git push origin prod git push origin prod:prod git push origin prod:refs/heads/prod
would all have been equivalent. Final trivia:
git push origin :prod
will delete the ref named
prod on the remote end.