且构网

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

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

更新时间:2023-12-01 10:48:40

你可以在Git仓库中做这件事:
$ b $ pre $ g $ grepstring / regexp$(git rev-list - 所有)

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

代码搜索将遍历所有公开托管在GitHub上的代码。您也可以按以下方式过滤:


  • 语言: language:

  • 存储库名称(包括用户名): repo:

  • 文件路径:路径:


Using git, how could I search within all files in all local branches for a given string ?

Github specific : is it possible to perform the above search across all github branches ? (There are several remote branches on my remote github repo that ideally I wouldn't have to bring down for this search..)

You can do this on a Git repo:

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

Github advanced search has code search capability:

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

  • the language: language:
  • the repository name (including the username): repo:
  • the file path: path: