Home
> source control > Git Patch to SVN Patch
Git Patch to SVN Patch
I have to work with SVN at my current job, but my favorite source control is Git. To enjoy my work I’m using locally Git repository and remotely centralized SVN one. There is many guides how to do it, here is one of them: Effectively Using Git With Subversion.
We have to follow pre-commit code review rule, so we are doing it by publishing patches. Unfortunately, merge tool from Windows’ Tortoise SVN does not recognize patches created by Git, wich on the other hand are properly recognized by unix tools like patch. To make it all work, I created simple Ruby script to convert Git patch to SVN patch standard.
Link to this script can be found here.
Usage is as follows:
git2svn.rb git.patch
Categories: source control
git, svn
pre-commit review lol, sounds like a bad place to be 🙂
no comments, maybe you’ll tell me? 🙂
Thanks a lot! Worked like a charm.
Is there something similar for converting svn patch to git patch? 🙂
Would be really useful!!!
Maybe it will be simpler if you could use git-svn?
I tried this out and got:
…/gitp2svnp.rb:17:in `gsub!’: invalid byte sequence in UTF-8 (ArgumentError)
from …/gitp2svnp.rb:17:in `block (2 levels) in ‘
from …/gitp2svnp.rb:16:in `each’
from …/gitp2svnp.rb:16:in `block in ‘
from …/gitp2svnp.rb:14:in `open’
from …/gitp2svnp.rb:14:in `
Yes, if I set a locale matching the encoding of the patch, it works. But is this really necessary just for conversion?
I modified script to force reading in utf-8 format. You can download it and try again. Then you can tell me if it works now.