Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Author Rewrite Utility

A simple Python utility to rewrite Git commit author and committer information across multiple repositories using git-filter-repo.

Use Cases

  • 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

What It Does

  • 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 origin remote back after rewriting.
  • Force-pushes the rewritten history to the same branch.
  • Deletes the temporary local repository after processing.

Requirements

  • Python 3
  • Git
  • git-filter-repo
  • GitHub authentication
  • python-dotenv package (pip install python-dotenv)

Configuration

Copy the example environment file:

cp .env.example .env

Then update .env with the new Git identity:

GIT_AUTHOR_NAME=YOUR_NEW_NAME
GIT_AUTHOR_EMAIL=YOUR_NEW_EMAIL

Usage

Add repository URLs to data.txt, one per line:

git@github.com:user/repo1.git
git@github.com:user/repo2.git

Run:

python git-author-rewrite.py

The utility automatically detects the current branch (main, master, etc.), rewrites the configured identity, and force-pushes only that branch.

Legacy Version

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.

About

Rewrite old Git commit author and email information across multiple repositories using git-filter-repo.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages