Skip to content

Instantly share code, notes, and snippets.

@wereHamster
Created November 9, 2010 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wereHamster/669059 to your computer and use it in GitHub Desktop.
Save wereHamster/669059 to your computer and use it in GitHub Desktop.
Cherry-pick a svn commit and add a 'Merged from rX' message at the bottom
#!/bin/sh
# $1 commit to cherry-pick
# $2 branch to apply it to (optional)
#
# Example usage:
# git svn-cherry-pick HEAD release-5.4
# rake test:all && git svn dcommit
commit="$(git rev-parse "$1")"
test -n "$2" && git checkout "$2"
git format-patch --stdout "$commit^!" | \
sed -e 's/^git-svn-id.*@\([0-9]*\) .*$/Merged from r\1/' | \
git am -3 -q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment