How to modify author of multiple commits in git
July 12th, 2009
I needed a nifty way of changing author name/e-mail in multiple commits when someone made commits with wrong authorship details.
The orig branch here contains the commits to be modified, and rewrite will contain the rewritten commits.
git checkout -b rewrite git reset --hard HEAD~4 # last four commits git format-patch --stdout HEAD..orig | sed 's/^From: Joe <foo@bar>/From: New <new@mail>/' > mbox git am mbox
Stanislav found another way to change author of git commits, but I prefer mine.
git checkout -b rewrite
Hehe, actually anonymous commenter found even nicer way to do this:
git-filter-branch –env-filter “export GIT_AUTHOR_NAME=’New name’; export GIT_AUTHOR_EMAIL=’New email’” HEAD