2015-04-04 92 views
0

我嘗試將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://stackoverflow.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

回答

2

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