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.
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 master
is unambiguous in the destination repository - this is almost always the case, unless you've done something deliberately confusing like create a tag called master
. When you do git push origin master
, git tries to interpret master
as a refspec. Since this refspec has no :
separating the source and destination refs, it assumes by default that you mean:
git push origin master:master
... and those incomplete ref names are expanded to refs/heads/master
on both sides (again, as long as master
is unambiguous both in the source and destination repositories).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With