Git format-patch to be svn compatible?

Is there any way to get a patch created with git format-patch to be svn compatible so that I can submit it to an svn repo?

I'm working off an svn repo on github and want to submit my changes back to the main repo. I need to create a patch to do this, however the patch cannot be applied since git formats that patch differently then svn. Is there some secret I haven't discovered yet?

UPDATE: Although currently there exists no script or native git way to do this, I did managed to find a post from earlier this year about how to manually accomplish this. I have followed the instructions and had success getting my git patches to work with svn.

If someone could take a stab at writing a script to accomplish this and contribute to the git project, I'm everyone would be much appreciated.

http://kerneltrap.org/mailarchive/git/2008/1/15/570308/thread#mid-570308


I always have to Google this but the way I've found that works perfectly (for me) is:

  • Create the patch with git diff --no-prefix master..branch > somefile.diff, the master and branch part are optional, depends how you want to get your diffs.
  • Send it wherever and apply with patch -p0 < somefile.diff.

It always seems to work fine for me and seems to be the simplest method that I've come across.


The short answer is patch -p1 -i {patch.file}.

Please refer to this blog for details: Creating Subversion patches with git.