Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# solution from
git fetch origin
git reset --hard origin/master
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
# from
# Source:
# You can add this alias:
git config alias.change-commits '!'"f() { VAR=\$1; OLD=\$2; NEW=\$3; shift 3; git filter-branch --env-filter \"if [[ \\\"\$\`echo \$VAR\`\\\" = '\$OLD' ]]; then export \$VAR='\$NEW'; fi\" \$@; }; f "
To change the author name:
# git change-commits GIT_AUTHOR_NAME "old name" "new name"
# or the email for only the last 10 commits:
# git change-commits GIT_AUTHOR_EMAIL "" "" HEAD~10..HEAD
# Alias:
# change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '$OLD' ]]; then export $VAR='$NEW'; fi\" \$@; }; f "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.