Is there a way to know or get the original create/modified timestamps?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
This accepts specific files as arguments or else updates each git-controlled file in the current directory or its children. This is done in a manner that permits spaces and even line breaks in filenames since
git ls-files -zoutputs a null-terminated file list andxargs -0parses null-terminated lists into arguments.This will take a while if you have a lot of files.