Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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