Skip to content

Instantly share code, notes, and snippets.

@rudolfolah
Last active February 29, 2024 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rudolfolah/4c9e4f61443ac71c5700e4987372ebe8 to your computer and use it in GitHub Desktop.
Save rudolfolah/4c9e4f61443ac71c5700e4987372ebe8 to your computer and use it in GitHub Desktop.
update github author for commits, useful for older repos with inactive/non-github associated emails
# Preserves the date when updating all commits
git -c rebase.instructionFormat='%s%nexec GIT_COMMITTER_DATE="%cD" git commit --amend --no-edit --author "Your Name Goes Here <your-email@example.com>"' rebase -r --root
# Updates all commits from the current HEAD commit until the given commit hash
git rebase -r <commit> --exec 'git commit --amend --no-edit --author "Your Name Goes Here <your-email@example.com>"'
# You can update all commits, use only if all the commits are your own!
# git rebase -r --root --exec 'git commit --amend --no-edit --author "Your Name Goes Here <your-email@example.com>"'
# Source: https://stackoverflow.com/a/75841127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment