Take the 2-minute tour ×

Is there anyway I can change all of the commit dates in GIT by subtracting, let's say a week, from all dates.

Like, instead of showing "On date Thu, Sept 10 2012 USER committed..." I would like it to say "On date Mon, Sept 3 2012 USER committed..."

This is for only one GIT repository. Thanks!

share|improve this question
why do you want to do that; rewriting history to say you did something earlier than you did is the only reason that comes to mind. –  AD7six Oct 23 '12 at 20:14

1 Answer 1

up vote 2 down vote accepted

Yes, you can do this with git filter-branch. Note however that this will impact all the hashes, too, all commits would be recreated and the repo history rewritten. So, it can be dangerous.

You'd need to use git filter-branch with an env filter that sets GIT_AUTHOR_DATE and GIT_COMMITTER_DATE variables. In github there is example script to change author info for all commits - it is similar stuff, you'd just need to use the variables I mentioned instead, as well as implement a logic that decides based on a given date what was the date a week ago.

Final warning: if anybody has already worked with that repo, things can get messy. From the github page:

This action is destructive to your repo's history. It's best to do this on a clone, just in case. Also beware that this should not be performed on a repo that has been shared with others. Use at your own risk.

share|improve this answer
+1 for the casual understatement of "things can get messy." –  ebneter Oct 23 '12 at 23:56
Thanks - well I will clone the repository and try to get it fixed (or broken) –  narcis Oct 26 '12 at 11:36

Your Answer


