Multiple simple shell scripts for rewriting Git history.
Clone this repository and add the scripts/ directory to your PATH to make the commands available as git subcommands:
git clone https://github.com/FlorianMichael/git-history-manipulations.git
cd git-history-manipulations
# e.g. in ~/.bashrc or ~/.bash_profile
export PATH="$PWD/scripts:$PATH"On Windows with Git Bash, you can do the same and add the export PATH=... line to your ~/.bashrc.
After that you can use the scripts as regular Git subcommands, for example:
git rewrite-author --help
git set-dates "2020-01-01T00:00:00" --no-dry-run
git replace-in-messages OLD NEW --no-dry-runRewrite all commits from a specific old email to a new name and email.
Usage (preferred):
git rewrite-author --old-email OLD_EMAIL --new-name "New Name" --new-email NEW_EMAIL [--dry-run|--no-dry-run] [--force]Positional fallback (deprecated):
git rewrite-author OLD_EMAIL "New Name" NEW_EMAILSet all commit dates to a fixed timestamp.
Usage:
git set-dates "2020-01-01T00:00:00" [--dry-run|--no-dry-run] [--force]Shift all commit timestamps by a time offset.
Usage:
git shift-dates "+2 hours" [--dry-run|--no-dry-run] [--force]Replace commit messages for commits with exactly one parent.
Usage:
git change-message "New message" [--dry-run|--no-dry-run] [--force]Search and replace text inside all commit messages.
Usage:
git replace-in-messages OLD NEW [--dry-run|--no-dry-run] [--force]Change the author, email, and date for a specific commit hash.
Usage:
git modify-commit HASH "Name" EMAIL DATE [--dry-run|--no-dry-run] [--force]- These scripts rewrite Git history; you may need to force-push afterward.
- Make scripts executable if needed (on Unix):
chmod +x scripts/git-*.
If you encounter any issues, please report them on the
issue tracker.
If you just want to talk or need help with git-history-manipulations feel free to join my
Discord.