目录
关键字查找
不同的参数灵活使用
- 查找所有包含hello字符串的文件:
git grep hello
- 显示关键字所在文件的行号:
git grep -n hello
- 不显示内容,只显示文件名:
git grep --name-only hello
- 查看每个文件有多少个匹配:
git grep -c hello
在特定版本里查找
- 在V1.0版本里查找
git grep string v1.0
组合查找
与查找、或查找
- 查找hello world:
git grep -e hello --and -e world
- 查找hello 或world:
git grep --e hello --or -e world
使用 git 帮助文档
man git grep
Git(Linux环境):提交查找(git grep)
最新推荐文章于 2025-04-08 09:00:00 发布