Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1066865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:04:37+00:00 2026-05-16T20:04:37+00:00

Is there a way to grep for something inside a Github project’s code? I

  • 0

Is there a way to grep for something inside a Github project’s code?

I could pull the source and grep it locally, but I was wondering if it’s possible through the web interface or a 3rd-party alternative.

Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:04:37+00:00Added an answer on May 16, 2026 at 8:04 pm

    Update May 2023:

    The new code search and code view is now generally available (May. 2023)

    (As noted by holydragon in the comments, that does require to sign in to GitHub first)

    At GitHub Universe last year, we announced a total redesign of GitHub’s code search and navigation experience, powered by our all-new code search engine that we built from scratch.
    And in February, we announced our public beta.

    Today, we are rolling out this feature to all GitHub users.

    https://i0.wp.com/user-images.githubusercontent.com/78169714/236855021-b5f60b03-78e4-46ac-a89d-7712cfb85aca.png?ssl=1 -- Screenshot of code search results

    Check out our blog post to learn more about how GitHub’s new code search and code view can help you search, navigate, and understand your code.
    And if you have feedback, please share it with us in our feedback discussion.


    Update Dec. 2021: search has been improved again, with Search for an exact string, with support for substring matches and special characters, or regexps.

    regex

    But only on cs.github.com, and still in beta (waitlist applies)


    Update January 2013: a brand new search has arrived!, based on elasticsearch.org:

    A search for stat within the ruby repo will be expressed as stat repo:ruby/ruby, and will now just workTM.
    (the repo name is not case sensitive: test repo:wordpress/wordpress returns the same as test repo:Wordpress/Wordpress)

    enter image description here

    Will give:

    enter image description here

    And you have many other examples of search, based on followers, or on forks, or…


    Update July 2012 (old days of Lucene search and poor code indexing, combined with broken GUI, kept here for archive):

    The search (based on SolrQuerySyntax) is now more permissive and the dreaded "Invalid search query. Try quoting it." is gone when using the default search selector "Everything":)

    (I suppose we can all than Tim Pease, which had in one of his objectives "hacking on improved search experiences for all GitHub properties", and I did mention this Stack Overflow question at the time 😉 )

    Here is an illustration of a grep within the ruby code: it will looks for repos and users, but also for what I wanted to search in the first place: the code!

    GitHub more permissive search results


    Initial answer and illustration of the former issue (Sept. 2012 => March 2012)

    You can use the advanced search GitHub form:

    • Choose Code, Repositories or Users from the drop-down and
    • use the corresponding prefixes listed for that search type.

    For instance, Use the repo:username/repo-name directive to limit the search to a code repository.
    The initial "Advanced Search" page includes the section:

    Code Search:

    The Code search will look through all of the code publicly hosted on GitHub. You can also filter by :

    • the language language:
    • the repository name (including the username) repo:
    • the file path path:

    So if you select the "Code" search selector, then your query grepping for a text within a repo will work:

    Good Search selector


    What is incredibly unhelpful from GitHub is that:

    • if you forget to put the right search selector (here "Code"), you will get an error message:
      "Invalid search query. Try quoting it."

    Wrong selector for the code filer

    • the error message doesn’t help you at all.
      No amount of "quoting it" will get you out of this error.

    • once you get that error message, you don’t get the sections reminding you of the right association between the search selectors ("Repositories", "Users" or "Language") and the (right) search filters (here "repo:").
      Any further attempt you do won’t display those associations (selectors-filters) back. Only the error message you see above…
      The only way to get back those arrays is by clicking the "Advance Search" icon:

    Advance Search Icon on GitHub

    • the "Everything" search selector, which is the default, is actually the wrong one for all of the search filters! Except "language:"…
      (You could imagine/assume that "Everything" would help you to pick whatever search selector actually works with the search filter "repo:", but nope. That would be too easy)

    • you cannot specify the search selector you want through the "Advance Search" field alone!
      (but you can for "language:", even though "Search Language" is another combo box just below the "Search for" ‘type’ one…)

    Wrong search selector


    So, the user’s experience usually is as follows:

    • you click "Advanced Search", glance over those sections of filters, and notice one you want to use: "repo:"
    • you make a first advanced search "repo:jruby/jruby stat", but with the default Search selector "Everything"
      => FAIL! (and the arrays displaying the association "Selectors-Filters" is gone)
    • you notice that "Search for" selector thingy, select the first choice "Repositories" ("Dah! I want to search within repositories…")
      => FAIL!
    • dejected, you select the next choice of selectors (here, "Users"), without even looking at said selector, just to give it one more try…
      => FAIL!
    • "Screw this, GitHub search is broken! I’m outta here!"
      …
      (GitHub advanced search is actually not broken. Only their GUI is…)

    So, to recap, if you want to "grep for something inside a Github project’s code", as the OP Ben Humphreys, don’t forget to select the "Code" search selector…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way I could use grep to ignore some files when searching
Is there way in next piece of code to only get the first record?
Is there a way to hide radio buttons inside a RadioButtonList control programmatically?
Is there a way to identify, from within a VM, that your code is
Is there a way to use grep or awk to find text files that
Is there a way to grep for only calls that over a certain amount
is there way thats i can preselect an item when the page loads or
Is there a way to enforce constraint checking in MSSQL only when inserting new
Is there any way to check whether a file is locked without using a
Is there a way to find the name of the program that is running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.