2

I set up a git repository for my LaTeX-documents. When I checkout an older version of the tracked files, all of them get the current timestamp.

Is it also possible to show the time when they were touched for the last-time before they were added to the git-repository?

I could not find anything like "keep original date/time" in man git-commit or man git-checkout.

Edward
  • 4,453
  • 8
  • 44
  • 82
  • related: http://stackoverflow.com/questions/25085396/date-modified-in-file-system-does-not-change-when-switching-branches-in-git-repo – jub0bs Sep 27 '14 at 16:29

1 Answers1

2

It's not possible nor is it desirable, since it would break any build system that relies on timestamps.

GIT FAQ on Timestamp preservation

Andrew C
  • 13,845
  • 6
  • 50
  • 57
  • 1
    Storing the information and using it by default, are two different animals. It indeed might be an interestng information, even though it's not desireable to use the original timestamp when extracting the files. – R_User Sep 29 '14 at 17:40
  • You can lookup both the author time and committer time of the commit that last touched the file - BUT - that doesn't tell you anything about when that commit showed up in your repository from a fetch. It's a fundamental issue with the way information is stored in Git – Andrew C Sep 29 '14 at 18:04
  • So how is it possible to list the author-times of all files in the repository of a commit with the ID `ABDCEFGH`? – Edward Oct 20 '14 at 12:47
  • The files don't have an author time, the commit does (which encompasses the entire commit). `git log --pretty=%ad ABDCEFGH -1` will just out just the author date/time for that SHA. – Andrew C Oct 20 '14 at 14:20