Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Are GitHub commit timestamps stored as Unix epoch time? If so, could we get similar timestamp accuracy when working with historical source code from systems like UNIVAC?


Yes, somebody could doctor those commits with the right timestamp so that we would get a clear historical progression.

It's doable, but would have to doctored, there was no git then, obviously.


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


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(+)


Ah, too bad. TIL.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: