Skip to content

Instantly share code, notes, and snippets.

@pathawks
Forked from jeresig/gist:199298
Last active December 20, 2015 19:59
Show Gist options
  • Save pathawks/6187165 to your computer and use it in GitHub Desktop.
Save pathawks/6187165 to your computer and use it in GitHub Desktop.
Change author information in past commits
#!/bin/sh
# Rename an email address in all old commits.
# WARNING: Will change all your commit SHA1s.
git filter-branch -f --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
case "$GIT_AUTHOR_NAME" in
oldname)
an="newname"
am="newemail@example.com"
;;
plugin-master)
an="plugin-master"
am="cabal@wordpress.org"
;;
esac
case "$GIT_COMMITTER_NAME" in
oldname)
cn="newname"
cm="newemail@example.com"
;;
plugin-master)
cn="plugin-master"
cm="cabal@wordpress.org"
;;
esac
export GIT_AUTHOR_NAME="$an"
export GIT_AUTHOR_EMAIL="$am"
export GIT_COMMITTER_NAME="$cn"
export GIT_COMMITTER_EMAIL="$cm"
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment