Git(Linux环境):提交查找(git grep)

目录

关键字查找

不同的参数灵活使用

在特定版本里查找

组合查找

与查找、或查找

使用 git 帮助文档


关键字查找

不同的参数灵活使用

  • 查找所有包含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

猜你喜欢

转载自blog.csdn.net/baidu_41388533/article/details/108422196