I recently realized I had goofed up with setting up my GIT account with an incorrect name. I found this cool way to update the logs and update the username to the correct one:
Note: This would update all commits so far. If you wanted to modify commits for specific user, then you may have to write a bash script for it. You can find more details here: http://stackoverflow.com/questions/750172/change-the-author-of-a-commit-in-git. But the below would work fine if it’s only yourself in the previous logs.
Just execute this command within your GIT home repository:
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='varun.verma'; GIT_AUTHOR_EMAILfirstname.lastname@example.org'; GIT_COMMITTER_NAME='varun.verma'; GIT_COMMITTER_EMAILemail@example.com';" HEAD