I enjoy using git because of its simplicity and speed. Recently, I have been working on a project of ours which uses SVN as a default version control system.
I proposed to my team to switch to Git as we can also use GitHub after that for making our code public. So, I decided to take the initiative to convert our SVN repository ready for GIT. There were 2 solutions to this:
- I use the latest stable code and then check it into the latest GitHub repository.
- I convert the whole SVN repository into Git repository.
I wanted to do the latter as I want to ensure that the commit logs are maintained across the clone.
So, after looking on the internet I found a few solutions using git-svn. The github site gives a good link on how to do it on a linux machine: https://help.github.com/articles/importing-from-subversion
However, I was looking for some Windows based solution which is easy to use and GUI based as I have to show it to my team as well. So, I decided to use TortoiseGIT [https://code.google.com/p/tortoisegit/wiki/Download?tm=2] which is a Windows based tool for git repositories.
Here are the steps I used using tortoiseGit to clone my SVN repository as a Git repository.
- Install TortoiseGit
- Create a new folder where you want to clone the repository.
- Now right clock on the folder and select the “Git Clone …” option.
- You will see a clone screen. Choose “From SVN Repository” and uncheck all boxes.
- Click OK.
It will take some time depending on your SVN repository size but in the end you will be presented with a Git repository in your folder.
Now, let’s do some Git command work to push this new code to Git –
1. git add –all
2. git commit –m “initial commit to git”
3. git remote add origin <git repo url>
4. git push –u origin master
This should do it – you should have everything in Git with proper commit logs history.