I have been using Subversion for a long time, and am relatively new to Git. This post is a little tutorial of what I have learnt getting Git and SVN to play nicely together, primarily using git-svn.
My goal is to maintain the code in the original SVN repository while transitioning the team to Git. This means changes to either repository get reflected into the other one.
First steps is to take the create an empty Git repository to import SVN into (this is your remote Git repository):
1 2 3 4 |
|
Now clone the empty Git repository so you have a working directory, and the import the SVN repository into Git. The directory names need to match (in this case, they are both “project”):
1 2 3 |
|
If all is going well, you should have a “project” directory with all of your files imported from SVN in it. This directory is also your Git clone. Now you can “push” these changes to your remote Git repository
1 2 |
|
Now make some changes to your working directory
1 2 3 4 |
|
We now have a change in Git that is not in SVN. To copy the change over to SVN we do a “dcommit”
1
|
|
Lets check out the SVN repository, and make a change in there
1 2 3 4 5 6 |
|
To get this change in Git, we need to “rebase”. This is not as scary as it sounds
1 2 3 4 |
|
Horay! We now know how to make changes go both ways between SVN and Git.