From: Oleg Broytman Date: Fri, 6 Feb 2015 20:39:26 +0000 (+0300) Subject: Add touch-all X-Git-Url: https://git.phdru.name/?p=git-scripts.git;a=commitdiff_plain;h=431d07c82a8f4b6ae361d1bdc4e459694a175940 Add touch-all Recursively find commit date/time for every file in the current directory and set the file's modification time to that date/time. --- diff --git a/touch-all b/touch-all new file mode 100755 index 0000000..a4be8c6 --- /dev/null +++ b/touch-all @@ -0,0 +1,8 @@ +#! /bin/sh + +# Recursively find commit date/time for every file in the current directory +# and set the file's modification time to that date/time. + +git ls-tree -r --name-only HEAD | while read filename; do + touch --date="`git log -1 --format="%cD" -- $filename`" "$filename" +done