Interactively rewrite Git commit author and committer dates.
Project description
Git Dates Modifier
📌 Overview
Git Dates Modifier, a Python script to rewrite commit dates (author date and committer date) selectively based on commit message matching. It supports separate modification of AuthorDate and CommitterDate for each matched commit.
✨ Features
- Read the repository commit history and display AuthorDate and CommitterDate.
- Interactively specify new Author and/or Committer dates for each commit.
- Support using
nowto set the date to the current time. - Preview planned changes before rewriting history.
- Uses
git-filter-repofor safe and flexible history rewriting.
⚠️ Important Warning
This script rewrites Git history. Rewriting history will change commit SHAs and can cause problems for collaborators or any public branches. Make a backup and ensure you understand the consequences before running the script. Prefer using this on local branches or repositories where you can force-push and coordinate with other contributors.
🧩 Prerequisites
-
Python 3.8+ (or a Python 3.x environment).
-
gitavailable on your PATH. -
git-filter-repoPython package installed. Install with:pip install git-filter-repo
🛠 Installation / Setup
Option 1: Install from PyPI (Recommended)
Install from PyPI, for example, using pip:
pip install git-dates-modifier
After installation, run it inside any git repository:
git-dates-modifier
Make sure the installation path of
pipis included in yourPATH.
Option 2: Run from source
Copy the script and place the script at the root of your git repository.
Ensure the script is executable or run it with Python. The script checks for a .git folder in the current working directory and will fail if not executed from a repo root.
▶️ Usage
Run the script from your repository root:
git-dates-modifier
The script will:
- Read commits (in chronological order).
- Prompt you for new Author Date and Committer Date for each commit.
- Press Enter to keep the original date.
- Enter
nowto use the current time. - Use a date/time string in the format:
YYYY-MM-DD HH:MM:SS(example:2025-10-24 11:22:33).
- Build a mapping of commit messages → date changes.
- Show a preview of planned changes.
- Ask for confirmation before executing
git-filter-repoto rewrite history.
Example prompt responses
- To skip changes for a commit: press Enter at both prompts.
- To update only the Author date: supply value only for the Author prompt.
- To set both dates to now: enter
nowat both prompts.
🧯 Safety & Troubleshooting
- Backup first: create a clone or branch backup:
git clone --mirror . /path/to/backuporgit branch backup-YYYYMMDD - If
git-filter-repois missing, the script exits with a helpful instruction to install it. - If the script fails during
git-filter-repo, the error will be printed. Investigate the message and restore from your backup if necessary. - The script uses exact message matching. If multiple commits share the same message body, they will receive the same changes.
📤 After Rewriting
Verify the new dates locally:
git log --format=fuller --date=iso
When ready to publish the rewritten history, force-push (with caution):
git push --force --all
Coordinate with any collaborators to avoid conflicts.
🌐 Encoding & Timezones
- Input date strings should be in
YYYY-MM-DD HH:MM:SSformat. The script tries to parse that and append the local timezone offset. nowsets the date to the current local time and includes the local timezone offset.
📄 License
This project is licensed under the terms described in the LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_dates_modifier-0.1.0.tar.gz.
File metadata
- Download URL: git_dates_modifier-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8b8ee99ba22fb34a995be19e679d85fd5341f4a0f2351b49cfc0dea1efe5fa7
|
|
| MD5 |
6fad1182ab5cc3554777b3216938bf45
|
|
| BLAKE2b-256 |
c9f0deb73dfd7ca97acc169ec4d638e3f1f5dea23eefc03f8614673df9f571a4
|
File details
Details for the file git_dates_modifier-0.1.0-py3-none-any.whl.
File metadata
- Download URL: git_dates_modifier-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
143bf2e76867a2de10eb496dd76838e0a3e6ee87c0fab8d00ecc1bb5f4b09aee
|
|
| MD5 |
44645a71b620eaea8c396bbbc8534636
|
|
| BLAKE2b-256 |
74535281c89df9a6cebc2cebe93ca8d1fe115b12bf44ee6538526b6252b50a42
|