comment 0

Patching email and name in old Git commit

Git is a wonderful piece of software. I just see how easy it is to fix old mistake on commit message. I needed to correct misspelled emails and names of author, committer and “signed-off-by” in all commit messages on a source tree. Using  filter-branch make it a piece of cake.

I based the following list of magic commands on this Tower documentation page. I also really like Tower, even though such feature (“mass commit message fix”) is not provided by this UI.

Fix bad email in author and committer:

Fix bad name only (author and committer)

Fix signed-off-by (by extension, can fix any misspell in all commit message):

Of course, keep in mind this will rewrite old commit (so changing it’s SHA-1), so you cannot just  git push your new tree. You need to accept to git push --force , effectively forcing everyone to rebase.