git库中,如何按字符串,全文搜索所有的历史提交中的历史文件?
例如,以搜索字符串 initBinder 为例:
for commit in $(git rev-list --all); do git grep -F "initBinder" $commit; done
搜索结果输出:
c539309cbe46c7aa21c0d43d61df4c1958889f9a:xxx/controller/DemoController.java: public void initBinder(WebDataBinder binder) {
59083df8fd088fd2c41ab23681a6ce18495b47dd:xxx/controller/DemoController.java: public void initBinder(WebDataBinder binder) {
c28905d5318f5b9951b6c0585715e9e21ac44b08:xxx/controller/DemoController.java: public void initBinder(WebDataBinder binder) {
759b7e8c338054ed73f943ced56146fdd6b08839:xxx/controller/DemoController.java: public void initBinder(WebDataBinder binder) {
...