Who are using Git as the version control may face in a situation where there is no option but to use SVN. In that case you will have to learn SVN commands to continue. But the most important thing you are not getting the facility of using git over SVN. “git-svn” can help you in that case. Many of you who are using git may already know about it. But this post is for those who don’t know and for those who knows but haven’t tried till now. Here are the basic commands for manipulation:
– To install it run:
$ yum install git-svn
– To clone a repo just replace the “svn co”/”svn checkout” phrase with “git svn clone” phrase. e.g.
$ git svn clone http://path/to/trank [project-name]
or
$ git svn clone svn+ssh://path/to./trunk [project-name]
$ cd project-name
Now you can use all the git commands like you normally do for a git repository including git add, git rm, git checkout, git commit. One thing to notice, git commit will commit your changes a git does normally. But to commit it in SVN repository you have to use:
$ git svn dcommit
This will commit all of your commit(s) that you have done using git in SVN repo as separate SVN commit(s).
To update your local version with server run:
$ git svn rebase
So clone, rebase and commit – these are the three times that you need to interact with SVN repo. Other things before dcommit can be handled by your favorite GIT.
So have a try. Its really coooool!!