Re: git and time

From: Jeff King <>
Date: 2006-09-27 09:33:22
On Tue, Sep 26, 2006 at 04:23:16PM -0700, Matthew L Foster wrote:

> After seeing how git currently accepts a remote repository's timestamp
> it occurred to me that git should probably instead prefer the time a
> particular changeset was committed to _this_ repository. Perhaps I

If you fetch a commit from a remote repository, it does not get
"committed" to the local repository. It is simply copied. Keep in mind
that the act of making a commit means making an immutable SHA1 object.
If, when you fetched that commit, you changed some aspect of it (like
the timestamp), it would cease to have the same SHA1, and thus the DAG
of your history would differ from the remote end.

During operations where the original commit isn't preserved (e.g.,
applying patches from an email), git applies the current timestamp as
the committer timestamp (but uses the email date as the author

> don't know enough about git but it seems to me the important
> information is when a particular changeset was committed to this
> repository, all other remote/sub/parent repositories' timestamps are
> secondary (or at least should be tracked separately).

That information is not tracked in the commit objects (because they are
never "committed" in the local repository, only copied); however, Shawn's
reflog implementation gives some indication of when each ref changed,
which shows when some (but not all) commits made it into the local

Keep in mind that git doesn't really CARE about timestamps to do most
operations; it operates on the graph created by parentage. Think of the
timestamps more as comments; when a commit is created, we comment who
did it and when, both accordinging to their local information.


PS Nit: Git doesn't work with changesets, it works with snapshots,
building a directed graph of snapshots. Maybe that is the source of your
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at
Received on Wed Sep 27 09:33:30 2006

This archive was generated by hypermail 2.1.8 : 2006-09-27 09:38:40 EST