使用git,我如何在所有分支中搜索字符串? [英] Using git, how could I search for a string across all branches?

查看:584
本文介绍了使用git,我如何在所有分支中搜索字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用git,我如何在所有本地分支中的所有文件中搜索给定的字符串?



Github特定:是否可以跨所有github分支? (在我的远程github回购中有几个远程分支,理想情况下,我不必为此搜索而降低成本。)

解决方案

你可以在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:

这篇关于使用git,我如何在所有分支中搜索字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆