使用 Git,如何在所有分支中搜索字符串? [英] Using Git, how could I search for a string across all branches?
本文介绍了使用 Git,如何在所有分支中搜索字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 Git,如何在所有本地分支的所有文件中搜索给定字符串?
Using Git, how could I search within all files in all local branches for a given string?
GitHub 特定:是否可以在所有 GitHub 分支上执行上述搜索?(我的远程 GitHub 存储库上有几个远程分支,理想情况下我不必为此搜索...)
GitHub specific: is it possible to perform the above search across all GitHub branches? (There are several remote branches on my remote GitHub repository that ideally I wouldn't have to bring down for this search...)
推荐答案
您可以在 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:
这篇关于使用 Git,如何在所有分支中搜索字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文