SG
sgaunet/gitcommit
CLI tool to create Git commits with custom historical dates while maintaining chronological integrity
gitcommit - Git Commit Date Setter
A command-line tool that enables developers to create Git commits with specific historical dates while maintaining chronological integrity.
Features
- โจ Create commits with custom dates in format
YYYY-MM-DD HH:MM:SS - ๐ Validates dates maintain chronological order (no backdating before last commit)
- ๐ Automatic local timezone detection
- ๐ Fast and lightweight (Go stdlib only, no external dependencies)
- ๐ Clear, actionable error messages
- โ
POSIX-compliant CLI interface (
--help,--version)
Installation
From Source
git clone https://github.com/sgaunet/gitcommit.git
cd gitcommit
make installVerify Installation
gitcommit --versionQuick Start
# Stage your changes
git add .
# Create commit with custom date
gitcommit "2025-02-05 20:19:19" "Historical commit message"Usage
gitcommit <date> <message>Arguments:
<date>: Date and time in formatYYYY-MM-DD HH:MM:SS<message>: Commit message text
Flags:
--help, -h: Show usage information--version, -v: Show version number
Examples
# Basic usage
gitcommit "2025-02-05 20:19:19" "Add feature X"
# Backdating offline work
gitcommit "2025-01-15 10:00:00" "Work done offline"
# First commit in new repository
git init
git add README.md
gitcommit "2025-01-01 00:00:00" "Initial commit"Requirements
- Go: 1.21 or later (for building)
- Git: 2.20 or later
- Platforms: Linux, macOS, Windows
Date Format Rules
- โ
Format:
YYYY-MM-DD HH:MM:SS(24-hour time) - โ Date must be after the last commit in the repository
- โ Future dates are allowed
- โ Empty repositories accept any date
- โ Dates equal to or before the last commit are rejected
Development
# Build
make build
# Run tests
make test
# Run linter
make lint
# Format code
make fmt
# View all commands
make helpTesting
# Run all tests with coverage
make coverage
# Run specific test
go test -v ./internal/datetime/...Architecture
cmd/gitcommit/ # CLI entry point
internal/
โโโ cli/ # CLI logic and orchestration
โโโ datetime/ # Date parsing, validation, formatting
โโโ git/ # Git repository operations
tests/
โโโ integration/ # Integration tests
โโโ testdata/ # Test fixtures
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes
- Push to the branch
- Open a Pull Request
License
MIT License - see LICENSE file for details.
Use Cases
- ๐ Organizing repository history chronologically
- ๐ผ Backdating work done offline
- ๐ Migrating commits from other version control systems
- ๐ Maintaining accurate project timelines
Troubleshooting
Error: "Invalid date format"
- Use exact format:
YYYY-MM-DD HH:MM:SS - Example:
2025-02-05 20:19:19
Error: "Chronology violation"
- Ensure date is after your last commit
- Check:
git log -1 --format="%aI"
Error: "Not a Git repository"
- Run from inside a Git repository
- Or initialize:
git init
Performance
- Date parsing & validation: <10ms
- Git operations: <100ms
- Total operation: <200ms (p95)
Credits
Built with โค๏ธ using Go standard library only.
Version: 1.0.0
Status: Production Ready
On this page
Languages
Go100.0%
Latest Release
v0.1.0November 14, 2025MIT License
Created November 13, 2025
Updated March 4, 2026