Migrate from SVN to Git
This quick guide will help you migrate from SVN to Git using the Git SVN clone method.
So, you've decided to migrate from Perforce to Git. Maybe you seek the flexibility of Git branches, are tired of Perforce's licensing model, or want better integration with modern tools like GitHub and GitLab. Whatever your reason, welcome to the world of distributed version control!
Before you hit "git p4 clone" and call it a day, let's walk through what this migration actually involves and how to install Git LFS.
Perforce (Helix Core) is ideal for large binary files and enterprise teams, particularly those in AAA game development or visual effects. However, Git has become more popular for game development over the last five years thanks to:
For this type of migration we will use Git P4 Clone and Python.
Find the git-p4 file in the C:\Program Files\Git\mingw64\libexec\git-core directory or the directory where you installed Git. Then, open the file with a text editor such as Notepad++ and on first line replace:
This is done so that Git P4 Clone will work properly with Python 3.
a) Right-click on the desktop or in a custom, empty folder that you created. Select "Open Git Bash Here" and type:
If the command doesn't work for you, take a look at the Perforce Client depot structure.
b) Based on the P4 depot results above or the Perforce client core depot structure, we will use depot testa and the main stream/branch depot in our example.
If you encounter any errors, make sure the name and structure of the depot are correct. This is usually verified using the p4 depots command.
c) Finally, rename your branch if is needed with the commands:
Before pushing to remote, you can clean up the project by converting .p4ignore to .gitignore, removing temporary folders, and renaming the main branch.
Next, decide if you will use a Git app, such as Anchorpoint or GitHub Desktop, to manage your project and push/pull to your remote servers. These apps handle Git LFS out of the box and provide a .gitignore based on your project instead of making you do this work yourself.
To continue using Git Bash commands, open a new Git Bash window in your project folder and install Git LFS to properly handle large binary files.
1) First convert your .p4ignore file to a .gitignore file. Although they are similar, some flags won't work in a .gitignore file. Learn more about the .gitignore template here.
Once you are satisfied with the file, commit it.
2) Next, we need to install Git LFS to manage our large binary files. To do so, we must first scan our project using the following commands:
Then to scan the project with:
As you can see in the image, we have a lot of PNG and WAV binary files. Since these will be the main files, I will import them as Git LFS objects.
All these files will be migrated to Git LFS objects, and a .gitattributes file will be created for future commits to handle these files as Git LFS.
3) Finally, push to a remote repository, such as GitHub, with: