1. Problem / approach

Git does not save the time stamps of the files in its versions. Only the time stamp of the whole commit is saved.

This approach comes from Linux where a copied file gets normally a new time stamp because the file is newly created. The files which comes after checkout are newly created.

This was an old approach in UNIX. Meanwhile the cp command has an option -p which preserves the the timestamp as also in DOS and Windows.

There is a reason to add a new time stamp to a copied or checked-out file: The behavior of the make-tool. The standard make tools accept a file as changed against the last make run with comparison of the time stamp of the associated destination file (often Object-file) with the source file. Hence the best way to designate that a file is a new time stamp, so the simple solution. And that is also the thinking of some developer using git.

In Windows, coming from DOS, normally copied files have the original time stamp. Sometimes therefore make tools do not run properly, and a "build new" approach is often used.

See vishia.org/JZtxtcmd/html/Zmake.html for a better solution.

2. Meaning of a time stamp of files

It may depend on personal preferences. For me, with the time stamp on a source file, I have immediately a relation, when the file was changed. Was in yesterday or last week, it means a new edit? Or was it before delivering the last software version? Or is it a really old version? Of course the time stamp can be touched. And a really old established file can be changed by a nonsense editing. But exactly for that the time stamp should be stored in a version archive.

Only when commit or check-in one should be sure that a non-desired change to a time stamp is not caught - a normal careful handling.

If you check out a version you should exactly able to see when the files are changed. That can be an approach for a maintainer of software. It is strongly my approach.

3. How it is possible to prevent time stamps in git

It is done additional to git, and outside. The base is a Java program which writes a list of time stamps of all files. This program is able to execute with

java org.vishia.util.FileList.list(sDir, sPattern, filelist.lst)

The created list is also commit in a git version, checked out and executed with

java org.vishia.util.FileList.touch(filelist.lst).

The last one restores the timestamp. Whereby, this program is carefully. It touches only the timestamp if the file size and also a CRC code of the content matches. If it does not match, the file has another content as in the list, and the touching should not be done.

…​TODO explain more.