跟踪 git 中的remotes/p4/master 分支
我正在克隆一个最初由 git-p4 生成的存储库。 git-p4 使用我想跟踪的“remotes/p4/master”分支。 我如何告诉克隆该存储库的 git 也跟踪遥控器/p4/master? 这样我就可以查看“origin/remotes/p4/master”或其他内容。
I'm cloning a repo that was first generated by git-p4. git-p4 uses a 'remotes/p4/master' branch that I would like to track. How do I tell git, which is cloning that repo, to track remotes/p4/master as well? That way I would be able to check out "origin/remotes/p4/master" or something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您也可以调整获取属性以镜像这些引用,尽管不是作为标准克隆的一部分。
因此,如下序列:
这将在
info-service.git
中获取refs/remotes/p4/release/1.1
例如refs/remotes/origin/ p4/release/1.1
在你的克隆中,你可以使用 git checkout -b r1.1-fixes origin/p4/release/1.1 来创建一个基于它的分支 话虽如此,在我的 Perforce 副本存储库中,我创建实际分支来镜像所有 p4 远程分支,主要是为了避免执行上述所有操作。 它还让我有机会修复从 p4 路径前缀到 git 分支名称的命名(因此
p4/main
变为master
、p4/release/1.1< /code> 变为
。r1.1
等)。 我使用我自己的 p4-to-git 复制,但是您可以通过使用 git for-each-ref 循环 p4 远程引用并使用 git update- 设置本地分支来执行相同的操作参考You can adjust the fetching properties to mirror those references as well, although not as part of a standard clone.
So a sequence like:
This will fetch
refs/remotes/p4/release/1.1
for example ininfo-service.git
to berefs/remotes/origin/p4/release/1.1
in your clone, and you could create a branch based on it withgit checkout -b r1.1-fixes origin/p4/release/1.1
Having said all that, in my Perforce replica repos, I create actual branches to mirror all the p4 remote branches, largely to avoid having to go through all the above. It also gives me a chance to fix up the naming from p4 path prefixes to git branch names (so
p4/main
becomesmaster
,p4/release/1.1
becomesr1.1
etc). I use my own p4-to-git replication, but you could do much the same by looping over the p4 remote refs withgit for-each-ref
and setting local branches usinggit update-ref
.