git-dates
v1.0.0
Published
Edit dates of your last git commits interactively
Readme
git-dates
Interactively edit the dates of your last git commits using your favorite editor.
Usage
git-dates [n]Opens your editor with the last n commits (default: 5), one per line, oldest first:
2024-01-03 10:00:00 +0100 # Add user authentication
2024-01-04 10:00:00 +0100 # Fix login redirect bug
2024-01-05 10:00:00 +0100 # Update dependenciesEdit the dates, save and close. Only modified dates will be rewritten. Everything after # is a read-only comment showing the commit message.
Since the binary is named git-dates, it also works as a git subcommand:
git dates 5Install
npm install -g git-datesOr from source:
git clone <repo-url> && cd git-dates
npm install && npm run build && npm linkHow it works
- Reads the last N commits via
git log - Writes a temporary file and opens
$VISUAL/$EDITOR/vi - Compares dates after the editor closes
- Runs
git rebase -iwith a customGIT_SEQUENCE_EDITORto amend changed commits
Both the author date and committer date are updated together.
Safety
The tool refuses to run when:
- You're not inside a git repository
- The working tree has uncommitted changes
- A rebase is already in progress
If nothing was changed in the editor, no rebase is performed.
Date format
YYYY-MM-DD HH:MM:SS ±HHMMExample: 2024-01-15 10:30:00 +0100
Requirements
- Node.js ≥ 18
- Git
License
ISC
