Change git user in history

From snippet wiki
Jump to: navigation, search

If you had a wrong user email setting and committed and pushed already:

To get back to the 5th last commit:

git rebase -i HEAD~5

Now you can change the pick keyword on each line to edit where it was wrong. Leave the editor and now you iterate via:

git commit --amend --author="Kai Kretschmann <kai@kretschmann.consulting>"
git rebase --continue

And finally get it back to the remote storage:

git push -f

Autoren der Seite / Contributors of the page

» Kai Kretschmann, (google+)