Checking out old file WITH original create/modified timestamps

YES, metastore or git-cache-meta can store such (meta-)information! Git by itself, without third party tools, can't. Metastore or git-cache-meta can store any file metadata for a file.

That is by design, as metastore or git-cache-meta are intended for that very purpose, as well as supporting backup utilities and synchronization tools.

(Sorry just a little fun spin on Jakub's answer)


I believe that the only timestamps recorded in the Git database are the author and commit timestamps. I don't see an option for Git to modify the file's timestamp to match the most recent commit, and it makes sense that this wouldn't be the default behavior (because if it were, Makefiles wouldn't work correctly).

You could write a script to set the modification date of your files to the the time of the most recent commit. It might look something like this:

IFS="
"
for FILE in $(git ls-files)
do
    TIME=$(git log --pretty=format:%cd -n 1 --date=iso -- "$FILE")
    TIME=$(date -j -f '%Y-%m-%d %H:%M:%S %z' "$TIME" +%Y%m%d%H%M.%S)
    touch -m -t "$TIME" "$FILE"
done

NO, Git simply does not store such (meta-)information, unless you use third party tools like metastore or git-cache-meta. The only timestamp that get stored is the time patch/change was created (author time), and the time commit was created (committer time).

That is by design, as Git is version control system, not a backup utility or synchronization tool.

Tags:

Git