Skip to content
Github 💻𝕏Linkedin 🔗

Sort by oldest git file

Git1 min read

Use this, if you want to print a list of files in a git repository sorted by the date since they were last touched.

git ls-tree -r --name-only HEAD | while read filename; do
echo "$(git log -1 --date=iso --format="%ad |" -- $filename) $filename"
done | sort -t '|' -k 1