Skip to content

Instantly share code, notes, and snippets.

@practicalli-johnny
Last active November 21, 2022 23:49
Show Gist options
  • Save practicalli-johnny/1647dff196001f5ca8a041e2a45e3bda to your computer and use it in GitHub Desktop.
Save practicalli-johnny/1647dff196001f5ca8a041e2a45e3bda to your computer and use it in GitHub Desktop.
Reset author on a range of existing commits in the Git commit history
# Rebase existing commit history and update the author information
# Useful when using multiple Git identities, work/community, etc.
# and the incorrect identity was used for a commit
# usually due to project `.git/config` not set to right identity
# Call script with relevant SHA (first 7 characters) of the earliest commit
# from where the author should be reset
# git-rebase-reset-author.sh abc4ef7
git rebase -i $1 -x "git commit --amend --reset-author -CHEAD"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment