A maintained fork of git-redate, originally by @PotatoLabs Potato Labs
Change the dates of several git commits with a single command.
Homebrew is currently not implemented.
You can also create debian/rpm packages for installing by cloning this repo and running make package in the project directory.
The make install command can be used to directly install the script in the current system and make uninstall can be used to reverse the install operation.
If you want to do it manually you can move the git-redate file into any folder in your $PATH.
For windows users, you may paste the file into ${INSTALLATION_PATH}\mingw64\libexec\git-core. Assuming you used the default settings the installation path will be C:\Program Files\Git.
Run git redate -h to see the full help. The short version:
git redate -c 10 # edit the 10 most recent commits
git redate --all # edit every commit on every branch
git redate --no-sign # don't re-sign anything
git redate -a -n # dry run: print what would happen, change nothing
git redate HEAD~10..HEAD~5 # edit a specific window of history
Positional arguments after the flags are passed to git log as rev-list args, so any range syntax git understands is fair game. They take precedence over -a and -c for choosing which commits land in the editor. The actual filter-branch rewrite is still anchored at the oldest commit you touched, so descendants between the top of your range and HEAD get rewritten as a side effect.
You'll have to force push to update remotes whose history changed.
Boolean flags accept --no- prefixes for clearing (e.g. --no-sign, --no-all), and short flags can be combined (-ad = --all --debug).
The script uses git's standard editor resolution: $GIT_EDITOR, then core.editor, then $VISUAL, then $EDITOR, then a sensible fallback. The old ~/.redate-settings prompt is gone.
Persistent defaults live under redate.* and are overridden by CLI flags:
git config --global redate.sign true # always re-sign (same as -s)
git config --local redate.commits 10 # use 10 instead of 5 in this repo
git config --global redate.signNow false # never sign at wall-clock time
Supported keys: redate.all, redate.commits, redate.debug, redate.dryRun, redate.iKnowWhatImDoing, redate.sign, redate.signNow. Variable names are case-insensitive per git config rules.
Make sure to run this on a clean working directory. git-redate refuses to run with uncommitted tracked changes; commit or stash first. If you really must override, --i-know-what-im-doing skips the check (filter-branch may still refuse on its own).
The --commits (a.k.a. -c) argument is optional, and defaults to 5 if not provided. If you ask for more commits than the branch contains, git-redate rewrites everything reachable from HEAD (including the root commit).
git-redate honours your existing signing config. If commit.gpgsign is true (locally or globally), rewritten commits will be re-signed automatically. The default behaviour is to fake gpg's system clock so the embedded signature timestamp matches the new commit date, keeping the signature history coherent.
Flags:
-s/--sign: force signing on, even whencommit.gpgsignis unset.--no-sign: force signing off, leaving rewritten commits unsigned.--sign-now: sign at wall-clock time instead of at the commit's (rewritten) date. Useful if you don't care about matching signature timestamps.
If a commit is being backdated to before the signing key existed, gpg cannot produce a faked-time signature. In that case git-redate transparently falls back to wall-clock signing for just those commits.
Only commits whose dates you actually changed get re-signed. Older versions of this fork (and earlier upstream behaviour by way of git filter-branch --commit-filter) would re-sign every commit in scope as the runner, including upstream commits authored by other people. git-redate now diffs the editor file against the original snapshot and only re-signs commits whose dates you actually edited. Untouched commits below the oldest edit retain their original hashes and signatures; untouched commits above it get rewritten as a side effect of the parent change but are not signed by you.
Only OpenPGP (gpg.format=openpgp, the default) supports backdated signature timestamps. With ssh or x509 signers, git-redate falls back to --sign-now automatically.
