“git pull”仅限分行
我有一个 git 克隆存储库。
此存储库的目的是 git log ,只要没有诸如 通过 ssh 进行 git 日志。
$ git ls-remote
ac118076af0ca4c164a831b9e31b1a307747ec36 refs/heads/master
db1253eae8241aa0813d5a49880c41cd810216c2 refs/heads/production/version-2011.10
32c2dcad3133c8214c0d0e898e32b7a7a9f068cf refs/heads/release/version-2011.11
我想仅为远程计算机上的 git pull 设置一个只读分支(跟踪分支?!)。
$ git branch -tb version-2011.11 refs/heads/release/version-2011.11
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'refs/heads/release/version-2011.11' which can not be resolved as commit?
$ git checkout -tb version-2011.11 release/version-2011.11
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'release/version-2011.11' which can not be resolved as commit?
将来:
- release/2011.11 将成为 Production/2011.11
- master -> release/version-2011.12
- 等等...
有什么建议吗?
I have a git cloned repository.
The purpose of this repo is git log
, as long there is no such thing as git log over ssh.
$ git ls-remote
ac118076af0ca4c164a831b9e31b1a307747ec36 refs/heads/master
db1253eae8241aa0813d5a49880c41cd810216c2 refs/heads/production/version-2011.10
32c2dcad3133c8214c0d0e898e32b7a7a9f068cf refs/heads/release/version-2011.11
I would like to set-up a read-only branch only for git pull
from remote machine (tracking branch?!).
$ git branch -tb version-2011.11 refs/heads/release/version-2011.11
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'refs/heads/release/version-2011.11' which can not be resolved as commit?
$ git checkout -tb version-2011.11 release/version-2011.11
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'release/version-2011.11' which can not be resolved as commit?
In future:
- release/2011.11 will become a production/2011.11
- master -> release/version-2011.12
- and so on...
any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
git ls-remote
显示远程存储库中的引用,因此refs/heads/release/version-2011.11
只是该存储库中的有效引用,而不是本地克隆。如果远程被称为origin
(默认情况下),那么您相应的远程跟踪分支将被称为:...或者您可以使用缩写:
origin/release/version -2011.11
(您可以看到的错误来自 git 尝试将最后一个参数解释为路径,因为它不知道具有该名称的引用。)如果您只想使用 git log ,那么你甚至不必创建一个跟踪远程跟踪分支的本地分支 - 您只需执行以下操作:
要更新该远程跟踪分支(以防远程存储库中发生更改),您只需执行以下操作:
git ls-remote
shows you the refs in the remote repository, sorefs/heads/release/version-2011.11
is only a valid ref in that repository, not your local clone. If the remote is calledorigin
(as it would be by default) then your corresponding remote-tracking branch will be called:... or you can use the abbreviation:
origin/release/version-2011.11
(The error you can see is from git trying to interpret the last parameter as a path, since it doesn't know of a ref with that name.)If you just want to use
git log
, then you don't even have to create a local branch that tracks the remote-tracking branch - you can just do:To update that remote-tracking branch (in case there have been changes in the remote repository) you can just do: