Skip to content

Instantly share code, notes, and snippets.

@arpat
Created October 13, 2016 15:33
Show Gist options
  • Save arpat/558ba8bceefa4f9da61ee1a5d3573f60 to your computer and use it in GitHub Desktop.
Save arpat/558ba8bceefa4f9da61ee1a5d3573f60 to your computer and use it in GitHub Desktop.
git command line tips and tricks
#!/bin/sh
# Blame: arunsmtp@gmail.com
# My version of github change git author script
# https://help.github.com/articles/changing-author-info/
if [ $# -eq 0 ]; then
echo "Usage: OLD_EMAIL CORRECT_NAME CORRECT_EMAIL"
echo "...and run from the toplevel."
exit 1
fi
git filter-branch --env-filter '
OLD_EMAIL="$1"
CORRECT_NAME="$2"
CORRECT_EMAIL="$3"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment