git grep 全字匹配_如何在github上搜索以获得完全匹配的内容(例如引号对Google的作用)...

在GitHub上无法直接进行全字匹配搜索,但可以通过使用`git grep`命令来实现。当官方搜索受限时,可以克隆仓库并使用`git grep "text-to-search"`。此外,推荐尝试更快的`ripgrep`工具:`rg "text-to-search"`,或者使用标准的`grep -r "text-to-search" /repository`进行文件搜索。
摘要由CSDN通过智能技术生成

I can search exact matches from google by using quotes like "system <

解决方案

You can't. The official GitHub searching rules:

Due to the complexity of searching code, there are a few restrictions

on how searches are performed:

Only the default branch is considered. In most cases, this will be the master branch.

Only files smaller than 384 KB are searchable.

Only repositories with fewer than 500,000 files are searchable.

You must always include at least one search term when searching source code. For example, searching for language:go is not valid, while amazing language:go is.

At most, search results can show two fragments from the same file, but there may be more results within the file.

You can't use the following wildcard characters as part of your search query:

. , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]

The search will simply ignore these symbols.

Clone and use git-grep:

git support searching in sources with git-grep command. Just clone a repository and use the command in the folder:

git grep "text-to-search"

Alternatives:

I recommend you to try ripgrep tool, it's fast and simple. Works like git-grep but looks nicer:

rg "text-to-search"

And you can use the standard grep to search any text in files:

grep -r "text-to-search" /repository

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值