I have the following bash function, which searches for all files in a repository, whose filename matches a regular expression. It currently finds all commits in which a file
Use git diff-tree -r --name-only --no-commit-id
(perhaps with --stdin
) instead of git ls-tree -r --name-only
. Use -m
or -c
if you are interested in merges, -M
or -C
if you want to take into account respectively, rename and copy detection.
Or better parse output of git diff-tree -r
.
Nb. the code given in question is seriously suboptimal (among others you check multiple times the same commits).