`git-utimes`: add --newer flag and don't touch files in the working tree and index by wpwoodjr · Pull Request #969 · tj/git-extras
The PR adds a new flag, -n or --newer, to git-utimes. This flag preserves the original modification date of files that originally were committed from the local repo, where the file may have been modified well before the commit date. The --newer flag causes git-utimes to only touch files with a date that is newer than their commit date.
Additionally, this PR addresses a few issues:
git-utimeswould change the date of files in the working tree and index to their commit date. This version doesn't touch files in the working tree and index, on the assumption that they are being worked on and the commit date is not relevant.git-utimeswould attempt to change the modification date on symbolic links. This was incorrectly changing the date on the linked file, not the symbolic link. This version correctly updates the link itself.git-utimeswas using the processor count to determine how many filesxargswould process on each command line (-nargument toxargs), which didn't seem to make much sense. This version passes 24 files on eachxargscommand line.git-utimeswas always touching files even if the modification date was the same as the commit date. After a pull, even files that were not modified by the pull would be touched. This version only touches files whose modification date is not the same as the commit date. This reports only updated files and makes it easier to understand which files have been changed by a pull.