Quantcast
Channel: Hacking Corner
Viewing all articles
Browse latest Browse all 20

How to modify author of multiple commits in git

$
0
0

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

Viewing all articles
Browse latest Browse all 20

Trending Articles