且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 Git,如何在所有分支中搜索字符串?

更新时间:2023-12-01 10:57:46

您可以在 Git 存储库上执行此操作:

You can do this on a Git repository:

git grep "string/regexp" $(git rev-list --all)

GitHub 高级搜索具有代码搜索功能:

GitHub advanced search has code search capability:

代码搜索将查看公开托管在 GitHub 上的所有代码.您还可以过滤:

The code search will look through all of the code publicly hosted on GitHub. You can also filter by:

  • 语言:语言:
  • 存储库名称(包括用户名):repo:
  • 文件路径:path: