最好用一个例子来解释:我在存储库的 0.58 分支上,这是我拉取的方式:
git pull origin 0.58
当我调用“git pull”时,我得到:
ip238:openlierox az$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.0.58.merge' in
your configuration file does not tell me either. Please
name which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details on the refspec.
If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:
branch.0.58.remote = <nickname>
branch.0.58.merge = <remote-ref>
remote.<nickname>.url = <url>
remote.<nickname>.fetch = <refspec>
See git-config(1) for details.
当我检查该分支时,似乎我可能忘记了一些选项(--track?)。不管怎样,我现在已经这样设置了:
git config branch.0.58.merge 0.58
git config branch.0.58.remote origin
这似乎有效。然后,出于兴趣,我查看了有关这些设置的其他一些分支:
ip238:openlierox az$ git config branch.0.57.merge
refs/heads/0.57
ip238:openlierox az$ git config branch.0.57.remote
origin
我现在想知道,“0.58”之间有区别还是应该指定“refs/heads/0.58”?
到底有什么区别呢?
A ref
是指向提交的任何内容,例如分支(头)、标签和远程分支。您应该在您的文件中看到磁头、遥控器和标签.git/refs
目录,假设您的存储库中拥有所有三种类型的引用。
refs/heads/0.58
指定一个branch命名为0.58。如果您没有指定 ref 所在的命名空间,git 将在默认命名空间中查找。这使得仅使用 0.58 变得不明确 - 您可以同时拥有一个名为 0.58 的分支和标签。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)