An interactive CLI tool for safely changing Git commit dates with built-in validation and multi-language support.
- 🔒 Safe by default - Works with unpushed commits by default
- 💻 Two modes - Interactive UI or CLI mode for automation
- ⚠️ Safety warnings - Multiple protection layers when working with pushed commits
- ✅ Smart validation - Automatic chronological order checking
- 🎨 Interactive UI - User-friendly interface with colored output
- 🌍 Multilingual - Support for English and Russian
- 🔄 Batch processing - Change multiple commits in one session
- 📅 ISO format - Simple and unambiguous date format (YYYY-MM-DDTHH:mm)
- 📊 JSON output - Structured output for automation and scripting
npm install -g commit-date-changerOr locally in your project:
npm install --save-dev commit-date-changerSimply run the command and follow the prompts:
commit-dateThe tool will:
- Show you a list of commits (unpushed only by default)
- Let you select a commit to modify
- Show the current date and valid date range
- Ask for a new date with validation
- Preview changes before applying
- Allow you to modify more commits in the same session
Options for interactive mode:
commit-date --count 20              # Show more commits (default: 10)
commit-date --allow-pushed          # Include pushed commits (⚠️ dangerous)Change commit dates directly from the command line:
# Basic usage
commit-date --hash abc1234 --date "2025-10-28T18:30"
# With JSON output for scripts
commit-date --hash abc1234 --date "2025-10-28T18:30" --json
# Modify pushed commit and skip confirmation
commit-date --hash abc1234 --date "2025-10-28T18:30" --allow-pushed --no-confirmCLI flags:
- --hash <hash>- Short or full commit hash
- --date <iso-date>- New date in ISO 8601 format (YYYY-MM-DDTHH:mm or full ISO string)
- --allow-pushed- Allow working with pushed commits (- ⚠️ dangerous)
- --no-confirm- Skip confirmations for pushed commits
- --json- Output result in JSON format
JSON output example:
{
  "success": true,
  "commit": {
    "hash": "abc1234",
    "message": "Add user authentication",
    "oldDate": "2024-01-01T10:30:00",
    "newDate": "2024-01-01T08:00:00"
  }
}commit-date --help                  # Show help
commit-date --version               # Show version🔍 Found 3 commits
  1. a1b2c3d (2024-01-01 10:30) Add user authentication
  2. d4e5f6g (2024-01-01 14:20) Fix login bug
  3. g7h8i9j (2024-01-02 09:15) Update README
? Select commit to change date: 1
✓ Selected commit: a1b2c3d
📅 Current date: 2024-01-01T10:30:00
   Valid range: no limit — 2024-01-01T14:19:59
? Enter new date and time (ISO format: YYYY-MM-DDTHH:mm): 2024-01-01T08:00
✓ New date: 2024-01-01T08:00:00
📋 Preview of changes:
   Commit:       a1b2c3d "Add user authentication"
   Old date:     2024-01-01T10:30:00
   New date:     2024-01-01T08:00:00
   Changing:     Author Date + Committer Date
? Apply changes? (Y/n) y
✨ Commit date successfully changed!
? Change another commit? (y/N) n
👋 Done!
# Change a local commit
$ commit-date --hash a1b2c3d --date "2024-01-01T08:00"
✨ Commit date successfully changed!
# Get JSON output
$ commit-date --hash a1b2c3d --date "2024-01-01T08:00" --json
{"success":true,"commit":{"hash":"a1b2c3d","message":"Add user authentication","oldDate":"2024-01-01T10:30:00","newDate":"2024-01-01T08:00:00"}}
# Change pushed commit (dangerous!)
$ commit-date --hash d4e5f6g --date "2024-01-01T15:00" --allow-pushed --no-confirm
✨ Commit date successfully changed!
⚠️  This commit was pushed. You need to force push: git push --force-with-lease- Node.js >= 18.0.0
- Git repository
- Clean working tree (no uncommitted changes)
By default, the tool:
- Works only with unpushed commits
- Doesn't require force push
- Is safe for team collaboration
Use only if:
- ✅ You're working in a personal branch
- ✅ Nobody else is using this branch
- ✅ You understand the consequences of force push
Modifying pushed commits:
- ⚠️ Rewrites Git history
- ⚠️ Requires- git push --force-with-lease
- ⚠️ Can break other developers' work
The tool will show multiple warnings and ask for confirmation before proceeding!
# Install dependencies
npm install
# Development mode
npm run dev
# Build
npm run build
# Run tests
npm test
# Format code
npm run formatMIT
Timur Arbaev