Skip to content

Instantly share code, notes, and snippets.

@auxiliary
Created August 28, 2017 14:05
Show Gist options
  • Save auxiliary/2fa3c7b3ea3cc22108c6c065dce957ff to your computer and use it in GitHub Desktop.
Save auxiliary/2fa3c7b3ea3cc22108c6c065dce957ff to your computer and use it in GitHub Desktop.
Git change commit alias
[alias]
change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;}; f "
# Usage:
# git change-commits GIT_AUTHOR_EMAIL "OLD EMAIL" "NEW EMAIL"
# git push --force --tags origin 'refs/heads/*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment