Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search a github project, but avoid "test" directories?

Is there any way to exclude certain directories when searching a particular github project?

In a large project on Github like nodejs, I often want to search the source code to find where in the project something is defined. A challenge I regularly run into is that the project itself contains hundreds of files related to module tests and these test directories clog up the search results when I'm trying to find something in the actual source, not in the testing code. So, instead of getting 5 pages of results to look through, I might get 50 pages of results, rendering the search somewhat useless.

In the nodejs project, I'd like to search without including the top level "test" directory.

like image 315
jfriend00 Avatar asked Mar 10 '26 13:03

jfriend00


1 Answers

To search in one particular directory you can use:

searchterm path:/lib

And to ignore a directory you can use:

searchterm -path:/test

As mentioned in your comment, the official documentation is here. An answer on how to ignore stuff can be found here.

like image 61
Mika Sundland Avatar answered Mar 13 '26 02:03

Mika Sundland