Skip to content

Instantly share code, notes, and snippets.

@acodeninja
Created January 10, 2018 08:32
Show Gist options
  • Save acodeninja/4427bc9af2469be8f476b1430ad9f0bf to your computer and use it in GitHub Desktop.
Save acodeninja/4427bc9af2469be8f476b1430ad9f0bf to your computer and use it in GitHub Desktop.
Rename author on all commits
#!/usr/bin/env bash
if [[ "$1" == "" ]] || [[ "$2" == "" ]] || [[ "$3" == "" ]]; then echo "Usage ./fix-git-author.sh \"old@email\" \"new@email\" \"New Name\""; exit 1; fi
git filter-branch --env-filter 'if [ "$GIT_AUTHOR_EMAIL" = "$1" ]; then
GIT_AUTHOR_EMAIL=$2;
GIT_AUTHOR_NAME="$3";
GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL;
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; fi' -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment