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
  • OR

    git push origin prod:refs/heads/prod

    What is the difference ?

  • gitignore certain file extensions in the branch
  • Git - Syncing a Github repo with a local one?
  • GIT Rebase operation was interrupted by a PC crash. Now repository is unavailable
  • .gitignore file adding “/bin/” each time something changes in the project
  • “The program 'rails' is currently not installed” after git clone
  • GitPython create local branch from remote branch
  • 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.

    Git Baby is a git and github fan, let's start git clone.