简体   繁体   中英

Searching code in a specific GitHub branch

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 code in non-default branch in my GitHub repository?

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 ).

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 )

If you know the filename you can use Find File .

在此处输入图片说明

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM