Skip to content

Change the dates of several git commits with a single command

Notifications You must be signed in to change notification settings

Quentium-Forks/git-redate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 

Repository files navigation

git-redate

Made by Potato Labs

Change the dates of several git commits with a single command.

alt tag

Installation

For homebrew users, you need to run brew tap PotatoLabs/homebrew-git-redate and then brew install git-redate.

If you're not using homebrew, you can clone this repo and move the git-redate file into any folders in your $PATH. Restart your terminal afterwards and you're good to go!

For window's 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.

Usage

Simply run: git redate --commits [[number of commits to view]]. You'll have to force push in order for your commit history to be rewritten.

To be able to edit all the commits at once add the --all option: git redate --all. This option can be negated with --no-all.

You can also specify a range of commits1 as a positional parameter, instead of --count or --all: git redate HEAD~10..HEAD~6

Make sure to run this on a clean working directory otherwise it won't work.

The --commits (a.k.a. -c) argument is optional, and defaults to 5 if not provided.

Note See git redate -h for further usage information.

Configuration

You may set default values for various git redate options in your Git client configuration.2

The available options are:

  • redate.all: takes a boolean value (true, false, yes, no, etc.2). When enabled, git redate defaults to editing all commits.
  • redate.commits: takes a positive integer. Used as the default number of commits to edit.
  • redate.debug: takes a boolean value. When enabled, git redate defaults to issuing extra diagnostic information to standard error.
  • redate.limit: takes a positive integer. Used as the default number of commits to modify in a single git filter-branch operation.
  • redate.original: takes a namespace. Used as the namespace where the re-dated commits will be stored.3
  • redate.gpgsign: takes a boolean value. When enabled, git redate defaults to signing re-dated commits.

Example configuration:

[redate]
all = no
commits = 10
debug = true
limit = 35
original = refs/redate
gpgsign = yes

Footnotes

  1. See git help gitrevisions for various ways to spell commit ranges.

  2. See git help config for more info on configuring your Git client. 2

  3. See git help filter-branch for more info on git filter-branch options.

About

Change the dates of several git commits with a single command

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%