git推问题 [英] git push question

查看:98
本文介绍了git推问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git push origin master:refs / heads / master 

与纯粹的区别有何不同:

  git push origin master 

谢谢。

解决方案

在v1.5.5.2之前版本的git中,这些命令之间存在着重要的区别。如果该分支尚不存在,则需要在refspec的目标端使用ref的全名。 (改变此行为的提交对该更改的一个有趣的描述。)



在当前版本的git中,只要 master 在目标存储库中是明确的,两者之间没有区别 - 这几乎总是如此,除非你已经做了一些故意混淆的事情,比如创建一个名为 master 的标签。当你执行 git push origin master 时,git试图将 master 解释为refspec。由于这个refspec没有分隔源和目标裁判,所以它默认假设你的意思是:

  git push origin master:master 

...以及那些不完整的ref名称在双方扩展为 refs / heads / master (同样,只要 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).

这篇关于git推问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆