Remix.run Logo
badc0ffee 6 days ago

Even if it was a 32-bit timestamp, you could still express dates back to December 13, 1901.

dgl 6 days ago | parent [-]

It's not; the git format defines it as a positive integer, see git help commit:

    DATE FORMATS
       The GIT_AUTHOR_DATE and GIT_COMMITTER_DATE environment variables support the following date formats:

       Git internal format
           It is <unix-timestamp> <time-zone-offset>, where <unix-timestamp> is the number of seconds since the UNIX epoch.
Changing a commit's timestamp is as simple as:

    $ git commit --amend --date='1970-01-01T00:00:00' --reset-author
    [main 6e1d001] test
     Date: Thu Jan 1 00:00:00 1970 +0000
     1 file changed, 1 insertion(+)
But dates before 1970 really don't work (in some cases it gives "fatal: invalid date format"):

    TZ=UTC git commit --amend --date='1969-12-31T23:59:59Z' --reset-author
    [main 47e54f0] test
     Date: Mon Dec 31 23:59:59 2012 +0000
     1 file changed, 1 insertion(+)
badc0ffee 5 days ago | parent [-]

Ah, too bad. TIL.