Skip to content

Instantly share code, notes, and snippets.

@pgrepds
Created March 22, 2022 15:25
Show Gist options
  • Save pgrepds/761ebdbeefdbed54683c6220504ed0d1 to your computer and use it in GitHub Desktop.
Save pgrepds/761ebdbeefdbed54683c6220504ed0d1 to your computer and use it in GitHub Desktop.
Change authorship of commits which are already pushed
Fix the author of commits which are already pushed.
To fix the last six commits:
* First set the correct author for current Git repo using `git config --local user.name FirstName LastName`
and `git config --local user.email [email protected]`
* Then apply to the last six commits `git rebase --onto HEAD~6 --exec "git commit --amend --reset-author --no-edit" HEAD~6`
* Finally, push using `git push --force-with-lease`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment