Vlad
Vlad

Reputation: 31

How get list of files in specified directory with commit dates in Git?

The following command prints list of commits for specified directory:

git log  -- "C:\WORKDIR\REPOS\some_repo\some_folder"

How to get list of files in the same directory with commit date? And to sort them by date or filename?

Upvotes: 1

Views: 778

Answers (1)

Vlad
Vlad

Reputation: 31

git ls-tree --name-only HEAD foldername/ | while read filename; do   echo "$(git log -1 --format="%cd " -- $filename) $filename"; done | sort -r

the same, but with recursive search in subfolders (can take some time)

git ls-tree -r --name-only HEAD foldername/ | while read filename; do   echo "$(git log -1 --format="%cd " -- $filename) $filename"; done | sort -r

Upvotes: 2

Related Questions