Git翻译 - > Perforce失败

Git翻译 - > Perforce失败

问题描述:

我尝试将Git存储库迁移到Perforce中。我曾尝试是(例如)Git翻译 - > Perforce失败

  1. 克隆git clone https://github.com/mbostock/d3.git
  2. 更改目录复制到新的文件夹
  3. git p4 submit

这失败后很短的提交而出现错误消息

fatal: Not a valid object name HEAD~1036 
Command failed: git cat-file commit HEAD~1036 

我还没有找到迁移工作的Git。我正在使用Git 1.9.5。我究竟做错了什么?

+1

Check out https://*.com/questions/2692884/git-p4-submit-fails-with-not-a-valid-object-name-head261 – Schwern 2015-04-04 16:53:24

+0

谢谢。但这个问题没有回答它的问题。 – 2015-04-04 18:34:21

git-p4是专门为克隆现有的p4回购,然后将其镜像到/从git。你正在尝试创建一个新的p4分支,而git-p4不能直接做到这一点。所以这有点复杂。

尝试以下操作:

1.在P4空分支的地方。

你需要一个客户端指向新的位置,//库/富:

$ p4 client whatever.... 

您还需要创建一个空文件,以保持P4开心:

$ touch P4EMPTY 
$ p4 -c your_client_name add P4EMPTY 
$ p4 submit -d 'Add empty file' 

2.克隆它:

$ cd /path/to/git/dir 
$ git p4 clone //depot/foo 

3.抓住你要导出的回购:

$ git remote add mycode git://whatever.git 
$ git fetch mycode 
$ git checkout -b upstream mycode/master 

4.调整基线是对P4回购:

$ git p4 rebase p4/master 

5.提交:

# We don't want to edit the commit message, so skip that part 
$ git config git-p4.skipSubmitEdit true 
$ P4CLIENT=your_client_name git p4 submit 

或者类似的东西... :-)

+1

没有为我工作; rebase给了同样的错误“不是一个有效的对象名HEAD〜43” – ScottJ 2015-07-23 02:04:29

Perforce的Git Fusion产品可以将Git存储库导入到Perforce中。

关于如何实现这一目标的信息位于:

http://www.perforce.com/perforce/doc.current/manuals/git-fusion/chapter_dyn_ngj_3l.html#section_ecm_qdq_nj

另一个优点使用Git融合,是用户不需要在他们的机器上安装任何东西。

希望这会有所帮助, Jen!