]> git.phdru.name Git - git-scripts.git/commitdiff
Add touch-all
authorOleg Broytman <phd@phdru.name>
Fri, 6 Feb 2015 20:39:26 +0000 (23:39 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 6 Feb 2015 20:39:26 +0000 (23:39 +0300)
Recursively find commit date/time for every file in the current directory
and set the file's modification time to that date/time.

touch-all [new file with mode: 0755]

diff --git a/touch-all b/touch-all
new file mode 100755 (executable)
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