Searching code in a specific GitHub branch

前端 未结 3 1702
深忆病人
深忆病人 2021-02-03 16:22

I am trying to search some code in a branch in a GitHub repository.

However this indicates that I can only search the default branch.

Is there a way I can search c

相关标签:
3条回答
  • 2021-02-03 17:11

    Using console, I would search for specific code in a specific branch with the following

    git grep 'my_search_text' my_branch
    
    • my_branch should be available locally
    • git grep can perform pattern matching of high complexity (see the documentation)
    0 讨论(0)
  • 2021-02-03 17:18

    Not from the GitHub web interface itself, as mentioned in "How can I search for a commit message on GitHub?": only the default branch (generally master) is indexed.

    Your best bet is to clone the repository, and there, search in all branches (with git log -S for instance).

    0 讨论(0)
  • 2021-02-03 17:18

    If you know the filename you can use Find File.

    https://github.com/angular/angular/find/6.1.x

    0 讨论(0)
提交回复
热议问题