This is quite simple on Linux. Here’s how…
-
Install git, subversion and git-svn (the latter can be installed on Ubuntu using
apt-get install git-svn
) -
Acquire a copy of an svn repository (or just a folder in the repository) as a git repository locally
git svn clone https://yoursubversionserver.com/svn/trunk/some_folder
Note: You can choose to omit the ‘some_folder’ at the end if you want everything in trunk. You can also be more specific about which folder you are interested in, eg.
git svn clone https://yoursubversionserver.com/svn/trunk/some_folder/wow/really/specifc/folder
-
Change a file in the repository and use the usual
git commit
command to commit it to a local repository -
To push changes from your local git repo to the subversion repo use
git svn dcommit
-
To pull down changes from the remote subversion repo to your local git repository use
git svn rebase
-
Just to be clear - in the last step we really did use the
git svn rebase
command to get changes from the remote repository.
Do not use
git pull
. See the REBASE VS. PULL/MERGE section of the git-svn docs as to whyDo not use
git clone/pull/merge/push
on your local git repositories that are derived from a subversion repo. See the CAVEATS section of the git-svn docs as to why
More basic examples are also list at the bottom of the git-svn docs.
And if you want to see a great example of a git-svn workflow in action, check out Jérémie Laval’s blog post - Working on Mono with git-svn.