gitgit-ls-filesgit-history

Searching in history of Git repro for specific files


How do I search in the history of my git repository for specific filetypes? (for example *.log)

I know I can search with ls-files in the current state or in a specific commit, but I want to search in all commits. This does include files that have been removed from the branch in earlier commits.

The end result should list all the filenames and the commits where the file was effected. With that list, I can go back to the earlier version of the file and review it.


Solution

  • To show all *.log files in whole history. You may want to write the output to a file or pipe into less. You can also add --pretty=short to reduce output

    git log --all --name-only -- *.log