如何在保持现有Git提交哈希的同时将Performce同步到Git?

如何在保持现有Git提交哈希的同时将Performce同步到Git?,git,perforce,git-p4,Git,Perforce,Git P4,我正在将我们的存储库迁移到git。在过渡期间,工程师仍将提交到Performce存储库。当工程师还在工作时,我将切换系统以使用Git存储库。因此,我一直在执行以下操作以保持存储库同步: 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

我正在将我们的存储库迁移到git。在过渡期间,工程师仍将提交到Performce存储库。当工程师还在工作时,我将切换系统以使用Git存储库。因此,我一直在执行以下操作以保持存储库同步:

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

这很好,但是我们的一个工具需要commit散列保持不变;上面创建了新的提交,因此也创建了新的提交哈希。使用
git-p4
git
我需要的东西是否可能?如果是这样的话,我想这需要使用
update refs
等的魔法,而对于
git
管道命令,我仍在学习过程中。

以下方法对我有效:

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

您是否考虑过运行Performce Git Fusion产品?是的,它看起来有助于转换,但它有太多的东西满足我们的需要。谢谢您的提示。我一直在寻找类似的东西,但一定是错过了。