We have moved most of our codebase from a monolithic svn repository into a set of git repositories. For various reasons, some work (on old versions of the project deployed in the field) has to continue in old svn branches, after they have been moved to git and deleted from the subversion trunk.
I have just done some work like this on an svn branch and re-applied the changes from the svn repository into the git repositories by doing the following:
cd <common_svn_commit_root>
svn diff -r 12344:12345 > ~/r12345.diff
gedit ~/r12345.diff
cd <common_git_commit_root>
git apply ~/r12345.diff
but it is rather cumbersome to do this for each and every svn commit, especially the gedit step, where I have to manually munge the svn paths into git paths (usually by prefixing the top level directory name).
One problem with trying some of the options presented so far is that the structure of the old svn repo and the new git repo are different. This is one of the reasons I have to edit the patch file.
The old directory structure was
svn
configurations
blah
mine
blam
plugins
foo
core
mine
bar
Whereas the new structure is
svn
plugins
bar
git
my_git
my_config
plugins
mine
core_git
plugins
core
foo_git
plugins
foo
I would really like to know if there is an easier way to do this, and understand what the best practice is for this situation.
Assuming that the directory structure of your sources kept the same, I suggest that you add a remote to your old SVN branch :
This way, you will be able to track changes on both old SVN branches, and your brand new Git server in local branches, and use git-cherry-pick to apply the commits containing the fixes on your Git server branches.
EDIT
Git keeps track of the file moves.
I did not try it myself, but if you clone the SVN repo, then locally move the directories to match you new Git server structure, cherry-pick merges could apply it on the moved files.
It already worked for me for some files, but maybe there’s some limitations. It definitely is worth the try.