Skip to content

Instantly share code, notes, and snippets.

@serg-z
Created January 31, 2014 00:58
Show Gist options
  • Select an option

  • Save serg-z/8724675 to your computer and use it in GitHub Desktop.

Select an option

Save serg-z/8724675 to your computer and use it in GitHub Desktop.
Rewrite commit history author & email (filter-branch)
#!/bin/bash
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "user.name before" ];
then
GIT_COMMITTER_NAME="user.name after";
GIT_AUTHOR_NAME="user.name after";
GIT_COMMITTER_EMAIL="user.mail after";
GIT_AUTHOR_EMAIL="user.mail after";
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