Skip to content

Instantly share code, notes, and snippets.

@jlschrag
Last active January 15, 2026 21:51
Show Gist options
  • Select an option

  • Save jlschrag/6f9a97b6f948fc03041ba0986e6b76ea to your computer and use it in GitHub Desktop.

Select an option

Save jlschrag/6f9a97b6f948fc03041ba0986e6b76ea to your computer and use it in GitHub Desktop.
Update Commit Author & Signing for a whole repo
# Ever foul up your git history? Yeah, me neither. 😁 But on the off chance you, say,
# committed using the wrong git account, which didn't have signing enabled, you could...
# in theory...do something like the steps below.
#
# Note: This was done on a repo where I was the only contributor,
# and I was ok rewriting history for EVERY COMMIT.
# Please understand each of these commands before you run them, and use at your own risk.
# Rebase all commits, replacing author:
git filter-repo --commit-callback '
commit.gpgsig = None
commit.author_email = b"my@email.com"
commit.author_name = b"Joe Schrag"
commit.committer_date = commit.author_date
'
# Re-sign the commits
git rebase --committer-date-is-author-date --rebase-merges --root -S
# Check that committer & author timestamps match
git log --pretty=format:'%h %an <%ae> author:%ad committer:%cd %s' --date=iso
git remote -v
# If that returns empty,
git remote add origin git@github.com...
git fetch
git push --force-with-lease origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment