Linux command
git-utimes 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Restore file timestamps
git utimes
说明
git utimes sets each tracked file's mtime to the timestamp of the last commit that modified it. Git intentionally stores no timestamps in the index — every checkout writes files with the time of the operation — and this command reverses that for tooling that depends on file dates (Make, find, sitemap generators, archive tools). The command walks all tracked paths in the working tree and runs touch -t with the matching commit time, so subsequent make-style "modified since" comparisons match the commit history rather than the moment the repo was cloned.
FAQ
What is the git-utimes command used for?
git utimes sets each tracked file's mtime to the timestamp of the last commit that modified it. Git intentionally stores no timestamps in the index — every checkout writes files with the time of the operation — and this command reverses that for tooling that depends on file dates (Make, find, sitemap generators, archive tools). The command walks all tracked paths in the working tree and runs touch -t with the matching commit time, so subsequent make-style "modified since" comparisons match the commit history rather than the moment the repo was cloned.
How do I run a basic git-utimes example?
Run `git utimes` in a terminal, then adjust file names, paths, flags, or remote targets for your system.