Resi Dwi Thawasa

TIL

Rewrite the commit author across history

Committed a bunch of work with the wrong author name, and some with a personal email I did not want public. Fixing the latest commit is easy (git commit --amend), but I needed to fix old ones too.

To rewrite the author on every commit back to the root:

git rebase -i --root \
  -x "git commit --amend --author 'Your Name <yourname@users.noreply.github.com>' -CHEAD"

The -x runs that amend on each commit during the rebase. -CHEAD reuses the existing commit message so nothing changes but the author.

If you only need to swap an email across history, git filter-branch (or git-filter-repo) is the heavier tool for that. And use a GitHub noreply email so your real address stays private.

#git