I’ve been looking around the internet and can’t find what this does:
git push origin master:refs/heads/master
What is the difference with just plain:
git push origin master
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In versions of git before v1.5.5.2 there was an important difference between these commands. You needed to use the full name of the ref on the destination side of the refspec if that branch did not already exist. (The commit that changed this behaviour has an interesting description of the change.)
In current versions of git there is no difference between the two, as long as
masteris unambiguous in the destination repository – this is almost always the case, unless you’ve done something deliberately confusing like create a tag calledmaster. When you dogit push origin master, git tries to interpretmasteras a refspec. Since this refspec has no:separating the source and destination refs, it assumes by default that you mean:… and those incomplete ref names are expanded to
refs/heads/masteron both sides (again, as long asmasteris unambiguous both in the source and destination repositories).