git clone changes file modification time

user3302761 picture user3302761 · Feb 12, 2014 · Viewed 18k times · Source

When I clone a git repository using "git clone ..." command all cloned files in my local repository have the same modification time with date and time when git clone command was issued.

Is there a way to clone remote git repository with actual modification time for each file?

Answer

VonC picture VonC · Feb 12, 2014

Git does not record timestamp for the files, since it is a Distributed VCS (meaning the time on your computer can be different from mine: there is no "central" notion of time and date)

The official argument for not recording that metadata is explained in this answer.

But you can find scripts which will attempt to restore a meaningful date, like this one (or a simpler version of the same idea).