Change commiter author name

Viewed 998

I need SOS help, I committed a project to bitbucket and committed by my name but I need to change the author name (and the email address).

bitbucket

What's the easiest way to do that?

1 Answers

You can simply amend your last commit and push (forced)

git commit --amend --author="Your name <yourEmail@example.com>"
git push --force 

As commented by [OznOg], if git config user.name and git config user.email are showing the right values, a --reset-author is enough:

git commit --reset-author 
git push --force

Your branch is ahead of 'origin/master' by 2 commits.

So the latest commit on BitBucket is not the latest locally: you have made two other commits.

First check if you can reset the one from bitbucket.

git checkout -b tmp
git reset --hard origin/master
git commit --amend --author="Your name <yourEmail@example.com>"
git push --force

If what you see if OK, then you can apply your two next commit:

git cherry-pick tmp~1
git commit --amend --author="Your name <yourEmail@example.com>"

git cherry-pick tmp
git commit --amend --author="Your name <yourEmail@example.com>"

git push
Related