Skip to content

Instantly share code, notes, and snippets.

@snipsnipsnip
Created December 23, 2013 20:53
Show Gist options
  • Save snipsnipsnip/8104372 to your computer and use it in GitHub Desktop.
Save snipsnipsnip/8104372 to your computer and use it in GitHub Desktop.
a commit filter for a git-svn'd repository (maps author and removes git-svn id but revision number)
git filter-branch --commit-filter '
case "$GIT_AUTHOR_NAME" in
*suzuki*)
GIT_AUTHOR_NAME="suzu"
GIT_AUTHOR_EMAIL="[email protected]"
;;
*)
GIT_AUTHOR_NAME="someone"
GIT_AUTHOR_EMAIL="[email protected]"
;;
esac
GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
git commit-tree "$@"
' --msg-filter '
ruby -e \'
head = STDIN.gets.strip
rest = STDIN.read
rev = (head+rest)[/@\d+/][1..-1]
msg = head if head !~ /git-svn/
print "r#{rev}#{': ' if !msg.empty?}#{msg}"
\'
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment