A simple Python utility to rewrite Git commit author and committer information across multiple repositories using git-filter-repo.
- If you previously used an old email address for Git commits, but that email is no longer available or has been removed from your GitHub account, use this tool to update the email in your old commits.
- Change an old Git/GitHub identity to a new one
- Update an incorrect author email across repositories
- Process multiple repositories automatically
- Reads multiple repository URLs from
data.txt. - Clones each repository locally.
- Detects the repository's current branch.
- Rewrites the configured author and committer name/email using
git-filter-repo. - Adds the
originremote back after rewriting. - Force-pushes the rewritten history to the same branch.
- Deletes the temporary local repository after processing.
- Python 3
- Git
git-filter-repo- GitHub authentication
python-dotenvpackage (pip install python-dotenv)
Copy the example environment file:
cp .env.example .envThen update .env with the new Git identity:
GIT_AUTHOR_NAME=YOUR_NEW_NAME
GIT_AUTHOR_EMAIL=YOUR_NEW_EMAILAdd repository URLs to data.txt, one per line:
git@github.com:user/repo1.git
git@github.com:user/repo2.gitRun:
python git-author-rewrite.pyThe utility automatically detects the current branch (main, master, etc.), rewrites the configured identity, and force-pushes only that branch.
The repository also includes git-author-rewrite-legacy.py, which contains the older implementation of the utility.
Use git-author-rewrite.py for the current and recommended implementation. The legacy version is kept for reference or compatibility with the previous approach.
⚠️ This tool rewrites Git history and uses force-push. Make sure you have a backup and permission to rewrite the repositories.