While transferring my code repositories from SVN to git, I completely forgot to change the author name in the commits, so the wrong user appeared. I could possibly just reconvert the svn repository to git to fix the issue but since I have been trying to merge the the SVN generated git with a new git that was the continuation of the last SVN checkout, when I succeeded I didn’t want to go through all that process again. Luckily I found the following post “How to change the author in git“.
The following code is taken from the source specified above:
git filter-branch --commit-filter ' if [ "$GIT_COMMITTER_NAME" = "Wrong Commiter Name" ]; then GIT_COMMITTER_NAME="Right Commiter Name"; GIT_AUTHOR_NAME="Right Commiter Name"; GIT_COMMITTER_EMAIL="email@example.com"; GIT_AUTHOR_EMAIL="firstname.lastname@example.org"; git commit-tree "$@"; else git commit-tree "$@"; fi' HEAD