Reputation: 261
How do I change the author of my commit after I've already pushed it to the upstream repository
Upvotes: 24
Views: 16044
Reputation: 1390
In case you got multiple git-push done without realizing that the commits went with a different email account. now you need to change that. here is the command I have used to transform all my previous commit with a different email to the new email id.
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='yourname'; GIT_AUTHOR_EMAIL='[email protected]'; GIT_COMMITTER_NAME='yourname'; GIT_COMMITTER_EMAIL='[email protected]';" HEAD;
Upvotes: 16
Reputation: 301177
You will have to amend the commit ( git commit --amend --author="New Author Name <[email protected]>"
) on your local repository and force push- git push -f
the change ( rewriting history is generally a bad practice once you have pushed upstream ).
Upvotes: 29