Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can I change commit author?

malikmuzammal2 September 3, 2020

I'm a novice, and I need to correct the author name in my initial commits.  I'm reading the excellent Bitbucket documentation, particularly the chapter on "undoing changes", but nothing seems to work: No matter what I try, the commits with the bad author name remain in my local file and also in the Bitbucket file If there is no way to fix this, can I just start over from scratch?

1 answer

2 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2020

Hi @malikmuzammal2,

The author is based on what is specified in your Git config settings, and you can change the settings by running these two commands:

git config --global user.name "your name"

git config --global user.email "your email"

To change the author on the latest commit you have to run this command:

git commit --amend --author="Author Name <email@address.com>" 

If the commit is not the latest commit, you have to do a rebase to get back to the specific commit to change it. Have a look at this KB on how to do it.

Note that all these commands are run locally in your copy of the repository and then pushed back to Bitbucket. Also, make sure that the user is set up correctly in Bitbucket, it uses the email address to identify the author. So if you have two users with the same email Bitbucket will show the author as the first user it encounters in the user directory that has that email.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events