Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github: Search code inside current repo

Tags:

github

I know it is possible to search code inside a repo, by typing in the search box:

my-keyword repo:user_name/repository_name

But since I'm using a lot of projects everyday, and love to go deep inside the source code to see how this or that works, it very quickly becomes annoying to have to enter repo: user_name/repository_name part each time I want to search something.

Is there any way to search code quickly inside the current viewed repo source code?

If I'm currently on the frankenstein/monster repo, I want to be able to search for the create_life method without having to enter repo: frankenstein/monster in the search box, since I'm already in this repo.

(It's as if you are working on a file in your text editor, press Ctrl+F and need to enter the filename of the current file)

like image 823
Byscripts Avatar asked Feb 13 '13 16:02

Byscripts


People also ask

How do I search the contents of a file in GitHub?

Select to search in current repository, not "All GitHub". It will display all "Entry" in particular file. Just to add a little something: the syntax seems to be <search term> filename:<filename> and you may search for it in your organization only (by adding org:<your organization name> .

Can you search in GitHub?

The GitHub Search API lets you to search for the specific item efficiently.


1 Answers

Update May 2013: see "Repository Search on all Repositories"

Today we are allowing you to search your own public repositories and any private repositories you have access to.

When you're on a repository page, you'll see an indication that you're searching that repository by default:

enter image description here


Original answer (February 2013)

I didn't find any "repo:current" or other convention that would specify the default repo for a "Code" search.

I usually do my search in a separate windows, with "Code" selected and the "repo:username/reponame" already filled in.
I only add the keyword I need and click enter.

I repeat the process multiple time, changing only the keyword, but if a result is of interest, I open it in another tab, in order to preserve the search page and their fields.

like image 63
VonC Avatar answered Oct 11 '22 00:10

VonC