Rewriting pushed commits with a different email address¶
Step 1:
While on your feature branch, run
$ git rebase -i HEAD~n
where n are the number of commits you would like to change
This will then open your commits in the default text editor for Git (which may be Vim or Vi, so you may wish to change this if you prefer a different editor).
Step 2:
Change the lines with 'pick' to 'edit' and then save and quit the file
Step 3:
$ git commit --amend --author= "[Your name] [your email address as shown on GitHub]" --no-edit
Step 4:
$ git rebase --continue
You'll need to run steps 3 and 4 n number of times, where n represents the number of commits that you are rewriting.
Step 5:
Once you've finished with the rebase, force push:
$ git push -f origin [your-branch-name]