开发者

git push question

开发者 https://www.devze.com 2023-04-06 01:48 出处:网络
I\'ve been looking around the internet and can\'t find what this does: git push origin 开发者_如何转开发master:refs/heads/master

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).


There is no difference. One is just a more verbose version of the other.

master:refs/head/masteris saying push your local master to the remotes refs/head/master

For more details, look at the last portion of this page.

0

精彩评论

暂无评论...
验证码 换一张
取 消