Skip to content

Instantly share code, notes, and snippets.

@louy
Last active August 29, 2015 14:27
Show Gist options
  • Save louy/3aba7749a3b6289ab240 to your computer and use it in GitHub Desktop.
Save louy/3aba7749a3b6289ab240 to your computer and use it in GitHub Desktop.
#!/bin/sh
# http://stackoverflow.com/a/2179876/1644422
for FILE in $(git ls-files)
do
TIME=$(git log --pretty=format:%cd -n 1 --date=iso $FILE)
TIME=$(date -j -f '%Y-%m-%d %H:%M:%S %z' "$TIME" +%Y%m%d%H%M.%S)
touch -m -t $TIME $FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment