gpt4 book ai didi

git - 从 perforce 迁移到 git

转载 作者:行者123 更新时间:2023-12-02 03:24:23 24 4
gpt4 key购买 nike

我有 perforce repo //depot/myprog/... 有分支作为

  1. //depot/myprog_branches/version1/myprg/...
  2. //depot/myprog_branches/version2/myprg/...

现在我想停止使用 perforce 并想将我的整个代码与分支和标记 histroy 迁移到 git 。

怎么做?我知道我可以使用 git p4 命令,但这需要花费两倍的时间,而且我们只有 12 小时的 perforce 登录 session ,该命令失败,因为它是自动注销的。

如有任何帮助,我们将不胜感激。

最佳答案

这有点令人讨厌,但您可以设置一个 cron,让您每隔一小时左右登录一次。您显然必须将密码放入 cron 脚本,这就是它令人讨厌的原因。

另一种方法是使用普通的 Perforce 命令在您想要开始的修订版中克隆您的存储库,然后欺骗 git-p4 使用它。

即像这样的东西:

$ p4 client
<create suitable client spec>
$ p4 sync //depot/foo
$ cd foo
$ git init
$ git add .
$ git commit

您的 git commit 需要采用正确的格式,即一条消息,后跟:

[git-p4: depot-paths = "//depot/foo": change = 1234]

然后做:

$ mkdir .git/refs/remotes/p4
$ git rev-parse HEAD >.git/refs/remotes/p4/master

现在 git-p4 将使用你的仓库:

$ git p4 sync

关于git - 从 perforce 迁移到 git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31181482/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com