β οΈ ACTIVE DEVELOPMENT WARNING
This project is in active development and may have breaking changes.
for now, there is no built-in way to backup/restore changes.
ALWAYS create a manual backup of your repository before using this tool.
π A tool for customizing your git commit timestamps
$ gt list
Found 3 commits to be shifted across 2 days:
π
2024-03-20:
β‘ 14:30:00 feat: add new feature
10:45:00 fix: update tests
π
2024-03-19:
β‘ 13:15:00 docs: update readme
$ gt set
β¨ Done! Your commits now have updated timestamps
git-timeshift is a tool that helps you customize your commit timestamps. Perfect for adjusting your github contribution patterns or organizing your commit history in a way that better reflects your coding schedule.
- flexible timestamp adjustment
- configurable time windows
- random time offsets for natural-looking commit patterns
- preserves commit order and relative timing
- simple command-line interface
- python 3.6+
- git-filter-repo
git clone https://github.com/richen604/git-timeshift.git
cd git-timeshift
pip install .
you can install git-timeshift using nix in several ways:
# install directly (nix 2.4+)
nix profile install github:richen604/git-timeshift
# temporary shell with git-timeshift
nix shell github:richen604/git-timeshift
if you're using NixOS, you can add it to your system configuration:
{
inputs.git-timeshift.url = "github:richen604/git-timeshift";
outputs = { self, nixpkgs, git-timeshift }: {
nixosConfigurations.yourHost = {
environment.systemPackages = [
git-timeshift.packages.${system}.default
];
};
};
}
you can use either git-timeshift
or the shorter alias gt
:
- initialize configuration:
$ gt init
π Setting up git-timeshift configuration...
Let's customize your commit timestamps
Preferred time window start? (HH:MM) [09:00]:
Preferred time window end? (HH:MM) [17:00]:
β¨ Configuration saved to ~/.config/git-timeshift/config.json
- list your commits:
$ gt list
Found 2 commits to be shifted:
π
2024-03-20:
β‘ 14:30:00 feat: add new feature
10:45:00 fix: update tests
- shift those timestamps:
$ gt set
Analyzing commits...
Ready to rewrite history? [y/N]: y
β¨ Done! Your commits now have updated timestamps
- modify a specific commit:
$ gt pick
1. 2024-03-20 14:30 - feat: add new feature
2. 2024-03-20 10:45 - fix: update tests
Enter commit number: 1
Enter new date (YYYY-MM-DD HH:MM): 2024-03-20 20:30
β¨ Done! Your commit has been shifted
the tool will create a config file at ~/.config/git-timeshift/config.json
with your preferences:
- time windows for commits
- active days
- shift strategy (earlier/later)
if you encounter any issues with the automated process, you can manually adjust commit timestamps using interactive rebase:
- start an interactive rebase:
git rebase -i HEAD~n # replace n with number of commits to modify
- mark commits you want to edit with
edit
instead ofpick
:
edit abc1234 feat: add new feature
pick def5678 fix: update tests
- for each commit, amend with a new date:
git commit --amend --no-edit --date="2024-03-20 20:30:00" # or --date="$(date) for current time
git rebase --continue
- times listed in preview are not the times that are set
- use worktrees to allow reverting changes
- handle next day rollover
- add timezone support
- custom random time offsets
- colored output
- command completion (tab completion for shells)
- interactive mode?
- unit tests
- integration tests
- type hints
- improve error handling
- debian packaging
- arch packaging
- nixos packaging
- homebrew packaging
- pypi packaging
- set up github actions - semvar etc
- improve pypi metadata
mit license - see license file for details
special thanks to:
- git-filter-repo - the powerful tool that makes this project possible