git commit - setting timestamps into the future

You should wait a bit.

Or you can do this:

/tmp/x 604% env GIT_AUTHOR_DATE='Wed Dec 19 15:14:05 2029 -0800' git commit -m 'future!'
[master]: created 6348548: "Future!"
 1 files changed, 1 insertions(+), 0 deletions(-)

/tmp/x 605% git log 

Author: Dustin Sallings <[email protected]>
Date:   Wed Dec 19 15:14:05 2029 -0800

    Future!

Note that there's both an author date and a committer date, so be sure to set the right one (or both).


You can amend the commit, an example with the year 2037:

git commit --amend --date="Wed Feb 16 14:00 2037 +0100"

I tried the year 2038 too but then I got a null value for the date.


If you want to retain an actual change-date when adding a project to git, you can do so with

env GIT_AUTHOR_DATE="`ls -rt *.cpp|tail -1|xargs date -u -r`" git commit -m "Old sources retaining old change-dates of last changed
 file: `ls -rt *.cpp|tail -1`, actual commit date: `date`"

This will commit with the change-date of the last-changed *.cpp-file, and a nice explaining message of the actual commit date.