5

I was browsing http://arago-project.org/git/projects/linux-omap3.git repo and came across a strange date-thing, which basically says that parent commit is a year younger than its child.

How is this possible?

user@ubuntu1004:/f/linux-omap3$ git log -2 --parents  4b8db3b
commit 4b8db3b368f5601717e3ffee0051628ba33172d3 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5
Author: Kevin Hilman <khilman@deeprootsystems.com>
Date:   Fri Aug 20 11:19:52 2010 -0700

    OMAP: bus-level PM: enable use of runtime PM API for suspend/resume

    [...skipped...]

    Cc: Rajendra Nayak <rnayak@ti.com>
    Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>

commit 3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 65f42886e24be2197b1263f138eabf40c6774d00
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Tue Jan 4 16:50:19 2011 -0800

    Linux 2.6.37
Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
Igor S.K.
  • 999
  • 6
  • 17
  • 2
    Committers can put in any timestamp they want, no? And if someone runs a system with the clock set wrong, that would happen. – Thilo Oct 17 '12 at 12:15
  • 1
    What happens to timestamps of "rebased" commits? Do they keep the original date? Then this could also happen. – Thilo Oct 17 '12 at 12:17
  • @Thilo I believe they keep the original timestamp. – Roman Oct 17 '12 at 12:47
  • 4
    There are also two separate dates stored on each commit - the author date and the committer date. These two can differ for many different reasons - rebase, cherry-pick, format-patch/am cycles, etc. – twalberg Oct 17 '12 at 13:49

2 Answers2

5

As mentioned in the comments:

What you see could be the result of a:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
2

The accepted answer is way more technically insightful, but I'll just add how this actually happened to me. I was debugging an issue that was affected by the local computer date, and was actively changing my system clock to track down the bug. After fixing it I committed everything to git unaware that my system clock was still set 2 months in the future, thereby screwing up my git history since I only noticed a few days later when commits showed up out of order in Github (d'oh!). This is supposedly fixable, though I haven't tried it yet.

Community
  • 1
  • 1
Brian Moeskau
  • 20,103
  • 8
  • 71
  • 73