Bash function to find all Git commits in which a file (whose name matches a regex) has *changed*

前端 未结 4 1717
渐次进展
渐次进展 2021-01-06 01:40

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

4条回答
  •  清酒与你
    2021-01-06 01:49

    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).

提交回复
热议问题