How to: find string in GitHub repo?
11,137
Solution 1
I'd clone the repo (which you'd need to do anyway if you want to create a PR for it) and git grep
it:
$ git grep string_to_look_for
Solution 2
From GitHub Developer Guide:
GET /search/code
Example:
https://api.github.com/search/code?q=addClass+in:file+language:js+repo:jquery/jquery
Solution 3
You can search an entire repo in github by using the search bar found at the top left corner of the screen.
Comments
-
Peter David Carter almost 2 years
I'm searching a fairly major GitHub repo for an error that's a) a big one b) easily fixed. I know where it is from the frontend, I just need to search the entire GitHub repo for a string.
How do I do that?
-
Peter David Carter over 6 yearsno need for
git [etc] | grep [etc]
, nice, will try -
BartoszMiller over 2 yearsGreat answer. Thanks.
-
Mark Jeronimus about 2 yearsThat doesn't search only strings. That searchers everything, including code, comments, and text files.
-
nikki ricks about 2 yearsYou're right. It does filter it for you by categories though. So after you search you could then click on "code" if you're wanting it to just be code.