How to change committed User name in bitbucket?

Amrit Dhungana picture Amrit Dhungana · May 2, 2014 · Viewed 17.3k times · Source

How to change commit username in bitbucket account ? To change in git I have used this command

 git filter-branch -f --env-filter " GIT_AUTHOR_NAME='newUser' GIT_AUTHOR_EMAIL='[email protected]' " HEAD

It only change username in local machine but not in my bitbucket account. How to change committed username in bitbucket ?

Answer

Alexandru Guzinschi picture Alexandru Guzinschi · May 21, 2015

Like Chris said, it is a bad practice to rewrite your git history.

The recommended way to map authors is to use the .mailmap feature.

Create a .mailmap file at the top level of your repository with the following content:

New Name <[email protected]> Old Name <[email protected]>

This will replace Old Name <[email protected]> in git history with New Name <[email protected]> and these changes will also reflect on Github and Bitbucket.