Skip to content

Instantly share code, notes, and snippets.

@mixu
Created September 4, 2014 21:02
Show Gist options
  • Save mixu/dbca40ec642ee652136e to your computer and use it in GitHub Desktop.
Save mixu/dbca40ec642ee652136e to your computer and use it in GitHub Desktop.
Find oldest files in a git repo
git ls-tree -r --name-only HEAD | while read filename; do
echo "$(git log -1 --format="%at | %h | %an | %ad |" -- $filename) $filename"
done
@chucker
Copy link

chucker commented May 15, 2023

If you want to handle cases where a file has been renamed but not otherwise modified since (and in those cases see the time stamp before the rename), add:

--follow --diff-filter=r

This looks for renames (--follow), then filters them out (lower-case r).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment