1

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?

Vlad
  • 31
  • 3
  • Does this answer your question? [How can I make git show a list of the files that are being tracked?](https://stackoverflow.com/questions/15606955/how-can-i-make-git-show-a-list-of-the-files-that-are-being-tracked) – mkrieger1 Sep 23 '21 at 08:01
  • 1
    Or https://stackoverflow.com/questions/11648942/git-ls-files-with-date – mkrieger1 Sep 23 '21 at 08:02
  • There is no example how to apply directory filtering (-- "C:\WORKDIR\REPOS\some_repo\some_folder") with those commands. – Vlad Sep 23 '21 at 09:01

1 Answers1

2
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
Vlad
  • 31
  • 3
  • 1
    I suggest changing format of the date from %cd to %ci as it sorts correctly, since %cd starts with weekday name. – solo Apr 29 '22 at 08:01