Skip to content

Instantly share code, notes, and snippets.

@jeremydw
Created June 20, 2014 17:41
Show Gist options
  • Save jeremydw/2679ba1b6938dcd27faa to your computer and use it in GitHub Desktop.
Save jeremydw/2679ba1b6938dcd27faa to your computer and use it in GitHub Desktop.
Changes a user's Git name and email address in a repo's commit history.
#!/bin/sh
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "<old name>" ];
then
GIT_COMMITTER_NAME="<new name>";
GIT_AUTHOR_NAME="<new name>";
GIT_COMMITTER_EMAIL="<new email>";
GIT_AUTHOR_EMAIL="<new email>";
git commit-tree "$@";
else
git commit-tree "$@";
fi' HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment