Created
June 16, 2011 08:10
-
-
Save katta/1028871 to your computer and use it in GitHub Desktop.
Converts git diff to svn patch format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" --ignore-space-at-eol > changes.patch |
I updated my fork https://gist.github.com/neosergio/5979125 because the parameters cause an error on my diff
Awesome. @neosergio is right, you're passing --ignore-space-at-eol
to sed here accidentally. I forked this here, added another bit of regex to trim off the context after @@
and to allow a bit more flexible usage: you can drop this one in your path and then call it will extra parameters (-U0 somefile
, etc.).
In case we already have a diff which got generated without "--no-prefix" option, here is a script git-diff-to-svn-path.sh that is inspired from this script gitdiff-svnpatch.sh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I took this code as a basis and created an alias.