Subversion (SVN) is a central version control system (VCS) while Git is a distributed version control system. SVN does some things very well and has been a great source control system. But the features that Git brings – distribution, performance, easy branches, easy merges, stash – are hard to pass up. These two tools have some big differences, but git has more advantage than svn, which is why a lot of companies are now migrating from svn to git. There are several ways to do migration process but now, in this document, we’ll just see the migration process through Git Native commands.
The prerequisites for the svn to git migration process are as follows and we must ensure that the tools below are installed before the migration process begins.
- Git Bash
- Git – SVN Tool
Git includes an incredibly useful tool, ‘git-svn’ which is a bidirectional connection between Git and SVN. It allows you to pull, and if you so desire push, commits to and from SVN. We recommend avoiding pushing back to SVN because, well, why would you? We’re here to switch, not combine! We’ll just use it to pull down all commit history, branches and tags from SVN.
In a nutshell, git-svn is a git command that allows using git to interact with Subversion repositories. git-svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation.
SVN to Git Migration using Windows PC:
The general workflow for this process is:
- Firstly, create a local folder in Windows PC.
- Initialize a Git repository with the SVN repository.
- Fetch from the SVN repository.
- Add the Git remote repository.
- Finally, Push everything to Git remote repository on the Git host.
Step 1: To start, create a local folder in Windows PC.
Step 2: Now, switch to created repository and initialize a git repository with the svn repository.
Step 3: Fetch from the SVN repository and saving it in local folder.
Step 4: Adding the Git remote repository.
Step 5: Finally, Pushing the data from local repository to Git remote repository.
SVN to Git Migration using Linux PC:
The general workflow for this process is:
- Open Putty.
- Login into Linux machine by providing credentials.
- Next, Create a directory i.e. > mkdir “Directory Name”
- Change the path from root to created directory path i.e. > cd “Directory Name”
- Initialize a Git repository with the SVN repository.
- Fetch from the SVN repository.
- Add the Git remote repository.
- Finally, Push everything to Git Repository on the Git host.
Step 1: Open Putty.
Step 2: Login into Linux machine by providing credentials.
Step 3: Next, Create a directory i.e. > mkdir “Directory Name”
Step 4: Change the path from root to created directory path i.e. > cd “Directory Name”
Step 5: Now, initialize a git repository with the svn repository.
Step 6: Fetch from the SVN repository and saving it in local folder.
Step 7: Adding the Git remote repository.
Step 8: Finally, Pushing the data from local repository to Git remote repository.
That’s it. We have migrated SVN repository to Git using Git native commands. You should now have a functioning Git repository with all your commits, branches and tags from SVN migrated to Git.