简体   繁体   English

Git push Refspecs:`refs / heads / *:refs / heads / origin`与`refs / heads / *:refs / heads / *`

[英]Git push Refspecs: `refs/heads/*:refs/heads/origin` vs `refs/heads/*:refs/heads/*`

Which push Refspec (Git) is correct? 哪个推送Refspec(Git)是正确的? Or both are correct? 还是两者都正确? What is the difference? 有什么区别?

  1. refs/heads/*:refs/heads/origin/*
  2. refs/heads/*:refs/heads/*

I prefer (1) because it references remote name (origin), and I don't understand what (2) means (but I see it used in some manuals!). 我更喜欢(1),因为它引用了远程名称(来源),而且我不明白(2)的含义(但是我在某些手册中看到了它的用法!)。

With refs/heads/*:refs/heads/origin/* , git push origin master would be expanded to git push origin refs/heads/master:refs/heads/origin/master . 使用refs/heads/*:refs/heads/origin/*git push origin master将扩展为git push origin refs/heads/master:refs/heads/origin/master It will create or update a branch named origin/master in the remote repository. 它将在远程存储库中创建或更新一个名为origin/master的分支。 It's valid, but refs/heads/origin/master would be ambiguous with refs/remotes/origin/master . 这是有效的,但是refs/heads/origin/masterrefs/remotes/origin/master可能是不明确的。 In some situations, it might cause errors. 在某些情况下,它可能会导致错误。

The 2nd is valid. 第二个有效。 With remote.origin.push=refs/heads/*:refs/heads/* , git push is expanded to git push origin refs/heads/master:refs/heads/master refs/heads/dev:refs/heads/dev , and git push origin master to git push origin refs/heads/master:refs/heads/master . 使用remote.origin.push=refs/heads/*:refs/heads/*git push扩展为git push origin refs/heads/master:refs/heads/master refs/heads/dev:refs/heads/dev ,和git push origin mastergit push origin refs/heads/master:refs/heads/master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM