Search code examples
githubgit-shell

GitHub: Search all branches/versions for string?


Is there a way to search all branches/all their versions for some string? Essentially the equivalent of doing ctrl+shift+f to search the entire solution...but for all versions and branches?

Longshot, but figured I would ask. If not, is there at least something for file name? Asking about github.com, but if it's in gitshell, that's cool too.

My dear friends decided to delete some code at some point in a branch that wasn't merged.


Solution

  • While this would be using Git instead of GitHub's web interface, how about something like this?

    git log --all --source -S"Some string"
    

    There is also a -G option that does regex instead of -S. The details are there if you do a

    man git log
    

    The only negative here is that it assumes you've already cloned the repository.