git grep 或者 ag 进行快速代码搜索

1.git grep foo 会自动map所有包含foo的文件

2.git grep -n foo  显示行号

3.git grep --name-only foo 只显示文件名

4.git grep -c foo 可以查看每个文件里有多个匹配内容

5.the_sliver_searcher 可以替代git grep的查找代码工具

https://github.com/ggreer/the_silver_searcher

5.1 安装

macOS

brew install the_silver_searcher

5.2 搜索

https://github.com/ggreer/the_silver_searcher

5.3 例子 在project目录下

ag 'dp"'


学会勇敢
原文地址:https://www.cnblogs.com/Sir-Lin/p/6208298.html