I want to search the source code of multiple remote repositories in GitHub

Asked 2 years ago, Updated 2 years ago, 42 views

What do you want to do

The goal is to put search words in multiple remote repositories every time, so I would like to create a batch that can automatically search multiple repositories if I put in search words.
Therefore, I would like to search the source code of the remote repository in github using the Windows command.

What I did

I was wondering if I could search the remote source code from the URL of git with the git grep command, but it doesn't work.

ideal

Once you have entered a search word, you have an image of all the expected remote repositories being searched and a file listing the search results is printed locally.
Please let me know if there is a better way, including the original method.

git github

2022-09-29 21:53

2 Answers

The GitHub search allows you to specify the repository to search for by writing repo:repository name, which is OR-searching if you specify more than one.Note: https://docs.github.com/ja/github/searching-for-information-on-github/searching-on-github/searching-for-repositories

For example, foo repo:torvalds/linux repo:llvm/llvm-project results in https://github.com/torvalds/linux and https://github.com/llvm/llvm-project query from .https://github.com/search?q=foo+repo%3Atorvalds%2Flinux+repo%3Allvm%2Fllvm-project&type=code"rel="nofollow noreferrer">https://github.com/search?q=foo+repo%3Atorvalds%2Flinux+repo%3Allvm%2Fllvm-project&type=code

If you want to search for multiple repositories on GitHub, I think that's pretty much the answer.

If you want to pull the remote repository as it is, simply git pull to place the file locally and use Select-String in PowerShell or grep in bash as you like.


2022-09-29 21:53

For GitHub only, if you enter . with the GitHub repository open in your web browser, the page transitions to github.dev and Visual Studio Code starts up in your browser.
If you have experience with Visual Studio Code, you can search as it is.


2022-09-29 21:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.