Contact Us

Let us know to help you out quickly!

 Pritesh     Feb,08 2017

Cloning SVN Repository to GIT on Windows

Since couple of weeks working on implementing Git Repository for our codebase of our all projects. Before this we were using SVN as versioning control but as Git getting more popularity we decided to move Git. Week ago wrote post regarding creating Git server and move some of code to Git which was not in any version control. Now it was time to move all our SVN repositories to GIT and of course do not want to lost all my code revision, comments etc. GIT support cloning from SVN which make job much easier for us. There are three easy steps to cloning SVN to GIT.

Just clone SVN repository to GIT with git svn clone command.

git svn clone -s -r1:HEAD http://[svn repo server]/[repository]

-r1 indicates from which revision you like to clone, in my case I want to move everything I specified 1 as version number. Cloning make take time based on size of your repository. Once cloning finish you may want to add remote repository where you want to push your changes and other developer can clone it.

git remote add origin http://[gitserver]/[git repo path]
	git push origin mater
	

Above command will link your bare repository with your cloned repository and push all changes to your bare repo. 
There may be case your developer team might working on SVN repository and committing their changes while you are working on migration before you move them all to Git there might some change in code which yet not push to Git. No problem, we can still get all changes made on SVN repository once we clone it to GIT. Just run below command to sync git and svn repository.
git svn rebase

And done I keep rebasing my repository and one by one my developer move to Git from SVN.