git-utimes
Modify file access and modification timestamps
TLDR
Change all files modification time to their last commit date
Change files modification time that are newer than their last commit date, preserving original modification time of files that were committed from the local repository
SYNOPSIS
git utimes [-t
PARAMETERS
-t
Specifies the timestamp to use instead of the commit time.
DESCRIPTION
The `git-utimes` command updates the access and modification timestamps of files tracked by Git to match the commit time of their last modification. This is useful for ensuring that build systems or other tools that rely on file timestamps function correctly after checking out a Git repository. It essentially 'resets' the timestamps to the time of the last commit where the file was changed. This tool can be used to fix cases where build systems depend on file timestamps and the checkout process changes the timestamp to the current time instead of the commit time.
This utility helps prevent unnecessary rebuilds or other timestamp-related issues that can arise after working with Git repositories.
CAVEATS
This command modifies file system timestamps and requires write access to the files in the repository.
Running `git utimes` may cause file managers or indexing services to re-index files, potentially impacting performance temporarily.
EXAMPLE USAGE
Update all files in the repository to their last commit time:git utimes
Update only the 'src/main.c' file:git utimes src/main.c
Update all files with timestamp from 2020:git utimes -t 2020
HISTORY
The `git-utimes` command is often implemented as a custom script or alias rather than being a core Git command.
It addresses a common need to reconcile file timestamps with Git history for build automation and other tools that rely on modification times.
SEE ALSO
git rev-parse(1), git log(1)