Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

github - how to search for text within a specific folder

Tags:

github

In Github, I use the top left search window to search within a repository.

I know the best way is to download the code and search but sometimes I'm unable to do so.

QUESTION

How can I limit the search to be within a specific folder?

like image 911
Bob Avatar asked Jun 23 '26 17:06

Bob


1 Answers

That's what the path: option is for, see Advanced Search.

Example, look for 'searchquery' in mozilla/MozDef but only in the tests/lib directory:

searchquery repo:mozilla/MozDef path:/tests/lib

Or in URL form that's

https://github.com/search?q=searchquery+repo%3Amozilla%2FMozDef+path%3A%2Ftests%2Flib
like image 151
stijn Avatar answered Jun 25 '26 23:06

stijn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!