GIT change commit author
Sometimes, if we forget to correctly configure GIT, default (or misconfigured) author credentials are saved into one or more commits.
Sometimes it is not an issue, but for some projects, external repository may disallow pushing.
Below there are few methods of how to repair commit author.
Changing author of the last commit
# Just reset to current default
git commit --amend --reset-author --no-edit
# Reset to current default, but let me edit commit message
git commit --amend --reset-author
# Just set to given value
git commit --amend --author "Foo Bar <foo.bar@net.com>" --no-edit
# Set to given value, but let me edit commit message
git commit --amend --author "Foo Bar <foo.bar@net.com>"
Changing author of multiple commits
# Reset last 10 commits to default author
git rebase -i HEAD~10 --exec "git commit --amend --reset-author --no-edit"
# Reset last 10 commits to given value
git rebase -i HEAD~10 --exec "git commit --amend --author 'Foo Bar <foo.bar@net.com>' --no-edit"