Skip to content

Instantly share code, notes, and snippets.

@johnl
Last active January 13, 2023 16:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnl/0513b334ccaaba30e48962647def9bf6 to your computer and use it in GitHub Desktop.
Save johnl/0513b334ccaaba30e48962647def9bf6 to your computer and use it in GitHub Desktop.
Change file modification timestamps to the last git commit timestamps for all files in a git tree
#!/bin/bash
git ls-files -z | xargs -0 -n1 -I{} -- git log -1 --format="%at {}" {} | perl -ane '($t,$f)=@F;utime($t,$t,$f)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment