I'm trying to migrate a perforce repository to git. I'm following this link and also I have gone through numerous stackoverflow questions. Finally now I'm able to migrate p4 code to git. However, I want to achieve 1 more thing post the migration.
Migration steps that I followed:
git p4 clone //depot/development/<path>/main/@all
git remote add origin [email protected]:<org>/demo.git
git branch -M main
git push -u origin main
Above steps work fine for 1 time migration.
Lets say there is a new commit in the perforce and I want to sync it to the git? How do I do it?
Steps I tried.
1. git p4 sync (works)
2. git rebase
3. git push -u origin main
No errors. However, I don't see the new p4 commit on the git. I'm sure I'm missing something here. Can anyone point me in the correct direction? I want to preserve the timestamp, author and ofcourse the changes in the commit when its sync'd to git. Also, I'm quite new to Git. A 1 liner on any command on what it does(if there are any command that I need to execute) really would help me understand it better. If you need any more details I'm happy to provide.
Thanks in advance.
I've tried it with a test server.
If you do
git log remotes/p4/masteryou'll probably see the new commits, but git-p4 sync doesn't put them into a local branch.If instead of:
You do:
You should get the new commits on your local branch.
You might want to do the original clone with
--branch=mainso that the perforce branch name is//remotes/p4/mainrather than//remotes/p4/master