views:

1143

answers:

3

I have my projects in 2 repositories. One under SVN and one under Git. Whenever I change something in SVN I want to do the same thing to the Git repository.

Say I make a change to SVN repository, producing revision 125. How would I apply these same changes to my Git repository (assuming my Git repository is up to date with revision 124).

Thank you.

+3  A: 

Try:

svn diff | patch -d /path/to/git/repo -p0

See svn help diff if you want to export a specific revision's diff.

MattJ
Why doesn't this work with the -p0 is left off?
Noah Campbell
See -pnum in http://linux.die.net/man/1/patch In particular search the page for words "not specifying -p". I think if you don't specify it - patch will ignore the filepath and just use the filename.
drozzy
+4  A: 

Thank's MattJ! What I actually did/looking for was:

cd /path/to/svn/repo
svn diff -r 125 > /tmp/patch.diff
cd /path/to/git/repo
patch -p0 < /tmp/patch.diff

But I up voted your answer!

drozzy
A: 

Besides using patch as mentioned above you could also consider setting up a post-commit hook so you don't have to do this every time you commit something new.

Federico Builes