1

I'm in the process of moving our repository to git. During the transition, engineers will still be submitting to the Perforce repository. While engineers are still working, I'll be switching systems to use the Git repository. As such, I've been doing the following to keep the repositories in sync:

rm -rf family
git clone ssh://git@example.com:7999/project/family.git

cd family
git p4 sync //depot/project/family@all
git rebase remotes/p4/master
git push -f

This works fine, but one of our tools needs the commit hashes to stay the same; the above creates new commits and, therefore, new commit hashes. Is what I need even possible with git-p4 and git? If so, I'm imagining it'll require magic with update-refs, etc and I'm still on the learning curve when it comes to git plumbing commands.

4

1 回答 1

3

以下对我有用:

rm -rf family
git clone ssh://git@example.com:7999/project/family.git

cd family
git update-ref refs/remotes/p4/master $(git log -1 --format='%H')
git symbolic-ref refs/remotes/p4/HEAD refs/remotes/p4/master
git p4 sync //depot/project/family || true
git p4 rebase
git push
于 2013-11-21T21:40:49.113 回答