GitHub Find file by its content - github

Can I filter files in a GitHub repository by file content?
For example, there is the public repo:
https://github.com/xamarin/mobile-samples.
I know that I can find file by name using this option:
https://github.com/xamarin/mobile-samples/find/master
But, can I filter results to files containing specified text eg. "Entry"?
Is there some query-string which I can use to do that?
I mean something like this:
https://github.com/xamarin/mobile-samples?content=entry

Just open repository, go to top search bar (where you search for other repos) and type:
Entry
Select to search in current repository, not "All GitHub".
To search for term in particular file of repository type:
Entry filename:example_filename.java
It will display all "Entry" in particular file.

Related

Github: Search a specific file belonging to all repositories written in a specific language

I want to find a string (say XYZ) in a yaml file. But my search should only list repos written in Java language.
I tried something like this. But this doesn't yield any results.
"search_string" filename:abc.yamls language:Java

How to exclude header files when i search repositories in github?

Sorry for rookie question, I want to search a specific API in Github, but want to exclude every file match that has a .h at the end, how to do this? I set the filter to only C files, but that doesn't exclude .h files.
If you are using Github Search Code API, and you want to remove a specific extension, add:
-extension:[your_extension]
Example: -extension:h to exclude all header files in your case
References:
documentation about the extension param
documentation about param exclusion
API example:
https://api.github.com/search/code?q=org:google%20language:c%20-extension:h
This also works on Github Search UI: https://github.com/search?q=org%3Agoogle+language%3Ac+-extension%3Ah

How to Capitalize the first letter of existing GitHub repository?

Situation is:
Currently, I have a repository name phimpme-iOS. I want to capitalize the first letter of the repository, Phimpme-iOS.
When I change the name in Settings > Options > Repository Name, it cannot be changed and it is showing -
The repository Phimpme-iOS already exists on this account
User names and repository names are case-insensitive at Github: phimpme-iOS is the same as Phimpme-iOS; that is, from Github PoV you're trying to rename the repo to an equivalent name.
Try a completely different name — xxx, for example — and then rename it once more to Phimpme-iOS.
Rename your repository to something completely different (e.g. "foo") and then name it back to the original name with the desired capitalization.

Search code in the repositories whose name contains a keyword

In github search, the following string allows me to search JavaScript code that contain Acode in all the repositories of the user NameOfUser:
user:NameOfUser language:JavaScript ACode
Now, I would like to add another condition: i am only interested in the code containing ACode in the repositories whose name contains repokey.
Does anyone know how to write the request?
The search API already does this. You can just use the search that you've posted above to search for repositories containing the text you've specified.
For example...
user:mrdoob language:JavaScript Three Extension
returns this...
https://github.com/search?utf8=%E2%9C%93&q=user%3Amrdoob+language%3AJavaScript+Three+Extension&type=Repositories&ref=searchresults
As above answer I also tried with type=Code and added a "WebGLBufferRenderer" keyword, See if it helps:
https://github.com/search?utf8=%E2%9C%93&q=user%3Amrdoob+language%3AThree+Extension+WebGLBufferRenderer&type=Code&ref=searchresults

GitHub Repository search using partial or begins-with

I would like to do a code search in a collection of repositories. I would like to restrict my search using a pattern or naming convention in the repository name.
1) I can limit my search by the organization.
Example: "user:google"
2) I can search a single repository directly.
Example: "repo:google/devtoolsExtended test"
So, is it possible to search all repositories that begin with a pattern?
Equivalent to: "repo:google/dev* test"
In order to search for repositories all you need to do is just type in your query, like the following:
https://github.com/search?q=foo
This finds repos such as FooTable and foodme as well, as if we searched for foo*. If you want to limit your search to the repository name only, use in:name, which results in:
https://github.com/search?q=foo+in%3Aname&type=Repositories
There's no explicit method of searching by begins with or using wildcards, but results for those kinds of searches appear as well.
Sources:
GitHub Help: Searching repositories