how to find the oldest files git 1

how to find the oldest files git

This emits // just a "last edit date" for each file, in an ISO format that sorts nicely.

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

Here is what the above code is Doing:
1. git ls-tree -r –name-only HEAD
– This lists all the files in the current commit.
2. while read filename; do
– This loops over the output of the previous command.
3. echo “$(git log -1 –date=iso –format=”%ad |” — $filename) $filename”
– This prints the last edit date of each file, followed by a pipe character, followed by the filename.

Similar Posts