Reputation: 19808
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://[email protected]: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.
Upvotes: 1
Views: 1146
Reputation: 19808
The following works for me:
rm -rf family
git clone ssh://[email protected]: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
Upvotes: 3