git-timemachine
Backdate Git commits at any time node, with natural-looking jitter and configurable daily limits.
git-timemachine is a command-line tool that records commits on Git repositories
at arbitrary timestamps. It backdates commits with randomized jitter so the
history looks natural, while enforcing per-repository and global daily commit
limits.
Built with Typer and pygit2 on Python 3.12+.
Quick start
# 1. Install from source
git clone https://github.com/garrett-he/git-timemachine.git
cd git-timemachine
uv tool install .
# 2. Stage changes and record a backdated commit (jitter applied automatically)
git add .
git-timemachine commit -m "Fix typo"
# 3. Review your commit history grouped by date
git-timemachine review
Features
- Record commits at calculated or explicit timestamps
- Retime an existing commit range at fresh timestamps with backup safety
- Randomized time jitter so commit times look natural
- Per-repository and global daily commit limits
- Shift the persisted base timestamp forward or backward
- Review commit history grouped by date
- Inspect and update internal state values
Requirements
- Python 3.12 or newer
- Git
- uv (recommended for installation and development)
Installation
Install from source with uv:
git clone https://github.com/garrett-he/git-timemachine.git
cd git-timemachine
uv tool install .
Or with pip:
pip install .
Run on demand without a permanent install:
uvx --from . git-timemachine --version
Usage
The entry point is the git-timemachine command. Global options must be placed
before the subcommand.
git-timemachine [--repo-dir PATH | -C PATH] [--version] COMMAND
| Option | Description |
|---|---|
-C, --repo-dir PATH |
Path of the target repository (default: current directory). |
--version |
Print the installed version and exit. |
commit
Record a commit at a calculated timestamp. Extra arguments after the options are
forwarded to git commit.
git-timemachine commit [--jitter-min SECONDS] [--jitter-max SECONDS] [--at DATETIME] [ARGS]...
| Option | Description |
|---|---|
-j, --jitter-min SECONDS |
Minimum time jitter (overrides jitter_min). |
-J, --jitter-max SECONDS |
Maximum time jitter (overrides jitter_max). |
--at DATETIME |
ISO datetime used as the base commit time (e.g. 2024-06-15T14:30:00). Defaults to the persisted last_commit_time. |
ARGS |
Extra arguments forwarded to git commit (e.g. -m "message"). |
git-timemachine commit -m "Fix typo"
git-timemachine commit --at "2024-06-15T14:30:00" -m "Backdated fix"
git-timemachine commit --jitter-min 60 --jitter-max 600 -m "Update docs"
retime
Re-record every commit from a starting commit up to HEAD at new timestamps.
Commit messages, author identities, and file contents (including binary files)
are preserved. Before rewriting, the current branch is copied to
<branch>-gtm-backup.
git-timemachine retime [COMMIT_ID] [--continue] [--jitter-min SECONDS] [--jitter-max SECONDS]
| Option | Description |
|---|---|
COMMIT_ID |
Starting commit: full SHA or abbreviated SHA of at least 6 characters. Required unless --continue. |
--continue |
Resume the interrupted session stored in .git/git-timemachine-session.yaml. |
-j, --jitter-min SECONDS |
Minimum time jitter (overrides jitter_min). |
-J, --jitter-max SECONDS |
Maximum time jitter (overrides jitter_max). |
git-timemachine retime a1b2c3
git-timemachine retime a1b2c3d4 --jitter-min 60 --jitter-max 600
git-timemachine retime --continue
shift
Adjust the persisted base timestamp in the state file forward or backward.
git-timemachine shift --days N [--hours-min 0-23] [--hours-max 0-23]
| Option | Description |
|---|---|
-d, --days N |
Number of days to shift (negative shifts backward). |
-h, --hours-min 0-23 |
Minimum hour for a randomized time of day. |
-H, --hours-max 0-23 |
Maximum hour for a randomized time of day. |
git-timemachine shift --days -1
git-timemachine shift --days 1 --hours-min 9 --hours-max 18
review
Print the commit history of the repository grouped by date.
git-timemachine review
states
Get, set, or list internal state values.
git-timemachine states # list all states
git-timemachine states KEY # get a state value
git-timemachine states KEY VALUE # set a state value
git-timemachine states
git-timemachine states last_commit_time
git-timemachine states last_commit_time "2024-06-15T14:30:00"
Configuration
On first run, git-timemachine creates two YAML files under
~/.git-timemachine/. Their locations can be overridden with environment
variables.
Settings
Path: ~/.git-timemachine/settings.yaml
(override with GIT_TIMEMACHINE_SETTINGS).
| Key | Default | Description |
|---|---|---|
max_repo_daily_commits |
5 |
Maximum commits per repository per day. |
max_total_daily_commits |
15 |
Maximum total commits per day across repositories. |
jitter_min |
600 |
Minimum random jitter added to a commit time, in seconds. |
jitter_max |
3600 |
Maximum random jitter added to a commit time, in seconds. |
States
Path: ~/.git-timemachine/states.yaml
(override with GIT_TIMEMACHINE_STATES).
| Key | Description |
|---|---|
last_commit_time |
Datetime used as the base time for the next commit. |
current_commit_date |
The date the daily counter applies to. |
daily_commit_count |
Number of commits recorded on the current date. |
Development
This project uses uv for dependency management and just as a task runner.
just install # install dependencies and pre-commit hooks
just check # run linters and formatters (check mode)
just format # apply formatters and auto-fixes
just test # run the test suite with coverage
just ci # run check and test together
just build # build the distribution
just publish # publish the distribution
The linting stack includes ruff, pyrefly, rumdl, and pyproject-fmt.
Tests run under pytest with a coverage threshold of 80%.
Metadata
Release files for git-timemachine 3.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| git_timemachine-3.2.0.tar.gz | 151.6 kB | Without provenance | Details for git_timemachine-3.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| git_timemachine-3.2.0-py3-none-any.whl | Python 3 | none | any | Details for git_timemachine-3.2.0-py3-none-any.whl |
Total release size: 170.9 kB
Release files / git_timemachine-3.2.0.tar.gz
| Download URL | git_timemachine-3.2.0.tar.gz |
|---|---|
| Size | 151.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97707ccfbd33e7d7c809438d1bc43c4d2d7178af2c69d0192a4416c94a86b5e4
|
|
BLAKE2b-256 checksum How to use checksums |
1c7482c3a133ed5798ce9079973ffeb25f1a749771951769daa0e8ff238dc811
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / git_timemachine-3.2.0-py3-none-any.whl
| Download URL | git_timemachine-3.2.0-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbfda83027c53e8b41e560a269fefabb8672ec2809fb49a40af728d965449592
|
|
BLAKE2b-256 checksum How to use checksums |
2d1febbecd9f7e97ada12c31ecd68bde58de780952027a45e88086811c5b2fe4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for git-timemachine 3.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.