Last active
April 28, 2021 07:50
-
-
Save SOF3/c690550f6883b5322aa4cdbce3a6112a to your computer and use it in GitHub Desktop.
Update the mtime of all files in a git repository to the last commit time instead of checkout time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Update the mtime of all files in a git repository to the last commit time instead of checkout time | |
git ls-files | \ | |
while read file; do | |
date="$(git log -1 --format="%cD" "$file")" | |
touch -d"$data" "$file" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment