GitHub is full of great open source projects and learning materials. How can you use these resources to smooth out your information asymmetry?

Then you should know how to search GitHub. Here are some tips for how to search GitHub accurately.

1. General search 📚

I believe that the average person is searching for items directly related to the technology stack.

The Best match, Most inspiring… To sort, select the appropriate language, select the repository or code to filter.

But does GitHub’s search function only support the above?

No!

If you only use the above features, then you only know the tip of the GitHub search iceberg!

GitHub search is very powerful! Here are some more advanced search techniques!

2. Search syntax 📚

When searching GitHub, you can build queries that match specific numbers and words.

2.1 Querying a value greater than or less than another value

You can use >, >=, <, and <= to search for values greater than, equal to, less than, and less than or equal to another value.

The query The sample
>n cats vue:>1000Matches warehouses with the word “VUE” and more than 1000 stars.
>=n vue topics:>=5Matches repositories with the word “vUE” that have five or more topics.
<n vue size:<10000Matches code containing the word “vue” in files less than 10 KB.
<=n vue stars:<=50Matches warehouses that contain the word “VUE” and have no more than 50 stars.

You can also use range queries: search for values greater or less than or equal to another value.

The query The sample
n.. * vue stars:10.. *Is equivalent tostars:>=10Matches warehouses with the word “vUE” and 10 or more asterisks.
*.. n vue stars:*.. 10Is equivalent tostars:<=10Matches warehouses that contain the word “vUE” and have no more than 10 asterisks.

2.2 Querying values between ranges

You can use range syntax n.. N The value in the search range, where the first digit n is the minimum and the second digit n is the maximum.

The query The sample
n.. n vue stars:10.. 50Matches warehouses with the word “vUE” and 10 to 50 asterisks.

2.3 Query Date

You can search for dates before or after another date, or within a date range, by using >, >=, <, <=, and range queries.

Date format must comply with ISO8601 standard, namely yyyY-MM-DD (year – month – day).

The query The sample
>YYYY-MM-DD vue created:>2016-04-29Matches issues created after April 29, 2016 that contain the word “vUE”.
>=YYYY-MM-DD vue created:>=2017-04-01Matches issues with the word “vUE” that were created on or after April 1, 2017.
<YYYY-MM-DD vue pushed:<2012-07-05Matches the code with the word “vue” in the repository pushed before July 5, 2012.
<=YYYY-MM-DD vue created:<=2012-07-04Matches issues created on or before July 4, 2012 that contain the word “vUE”.
YYYY-MM-DD.. YYYY-MM-DD vue pushed:2016-04-30.. 2016-07-04Matches warehouses with the word “vUE” that were pushed between late April and July 2016.
YYYY-MM-DD.. * vue created:2012-04-30.. *Matches issues created after April 30, 2012 with the word “vUE”.
*.. YYYY-MM-DD vue created:*.. 2012-04-30Matches issues created before July 4, 2012 with the word “vUE”.

You can also add optional time information THH:MM:SS+00:00 after the date to search by hour, minute, and second. This is T, followed by HH:MM:SS (hour – minute – second) and UTC offset (+00:00).

The query The sample
YYYY-MM-DDTHH:MM:SS+00:00 vue created:2017-01-01T01:00:00+07:00.. 2017-03-01T15:30:15+07:00Match at 1:00 am, January 1, 2017 (offset from UTC07:00) and 3 p.m. March 1, 2017 (offset from UTC07:00) created between issues. UTC offset07:00, March 1, 2017 at 3pm. UTC offset07:00.
YYYY-MM-DDTHH:MM:SSZ vue created:2016-03-21T14:11:00Z.. 2016-04-07T20:45:00ZMatch issues created between March 21, 2016 at 2:11 PM and April 7, 2016 at 8:45 PM.

2.4 Exclusion of specific outcomes

You can use the NOT syntax to exclude results that contain certain words. The NOT operator can only be used for string keywords, NOT numbers or dates.

The query The sample
NOT hello NOT worldMatches a warehouse that contains the word “hello” but not the word “world”.

Another way to narrow the search results is to exclude a specific subset. You can prefix any search qualifier with – to exclude all results that match that qualifier.

The query The sample
-QUALIFIER vue stars:>10 -language:javascriptMatches repositories that contain the word “vue” and have more than 10 asterisks but are not written in JavaScript.
mentions:Wu-Yikun -org:githubMatches issues that mention @Wu-yikun and are not in the GitHub organization repository

2.5 Use quotation marks for queries with Spaces

If you search for queries that contain Spaces, you need to enclose them in quotes. Such as:

  • Vue cats NOT “Hello World” Matches warehouses that contain the word “vue” but do NOT contain the word “Hello World”.
  • Build Label :” Bug fix” matches issues with the label “bug fix” and the word “build”.

Certain non-alphanumeric symbols, such as Spaces, are removed from the code search query within quotes, so the results can be unexpected.

2.6 Querying User Names

If the search query contains qualifiers that require a user name, such as User, actor, or assignee, you can specify a specific person using any GitHub user name, or specify the current user using @me.

The query The sample
QUALIFIER:USERNAME author:biaochenxuyingMatch @biaochenxuying creation submission.
QUALIFIER:@me is:issue assignee:@meMatches the issues assigned to the result viewer

@me can only be used with qualifiers, not as a search term, such as @me main.workflow.

3. Advanced search 📚

3.1 Search by warehouse name, description or readme file content

With the IN qualifier, you can limit your search to the warehouse name, warehouse description, readme file contents, or any combination of these.

If this qualifier is omitted, only the warehouse name and description are searched.

qualifiers The sample
in:name jquery in:nameMatches a repository whose name contains “jquery”.
in:description vue in:name,descriptionMatches a repository whose name or description contains “vue”.
in:readme vue in:readmeMatches the warehouse that mentions “VUE” in its readme file.
repo:owner/name repo:biaochenxuying/blogMatches a specific warehouse name, such as the blog project for user Biaochenxuying.

3.2 Search within a user’s or an organization’s repository

To search through all repositories owned by a particular user or organization, you can use the user or org qualifier.

qualifiers The sample
user:USERNAME user:biaochenxuying forks:>=100Match from @biaochenxuying, warehouse with over 100 forks.
org:ORGNAME org:githubMatches the repository from GitHub.

3.3 Search by Warehouse size

The size qualifier uses the greater-than, less-than, and range qualifiers to find repositories that match a particular size, in kilobytes.

qualifiers The sample
size:n size:1000Matches a repository that happens to be 1 MB.
size:>=30000Matches warehouses with a minimum size of 30 MB.
size:<50Matches warehouses smaller than 50 KB.
size:50.. 120Matches warehouses between 50 KB and 120 KB.

3.4 Search by Followers

You can use the Followers qualifier and the greater than, less than, and scope qualifiers to filter the repository based on the number of followers it has.

qualifiers The sample
followers:n node followers:>=10000Match repositories that have 10,000 or more followers mentioning the word “node”.
styleguide linter followers:1.. 10Matches warehouses that have 1 to 10 followers and mention the term “Styleguide linter”.

3.5 Search by Forks

The Forks qualifier specifies the number of replicas that the warehouse should have using the greater than, less than, and range qualifiers.

qualifiers The sample
forks:n forks:5Matches warehouses with only 5 replicas.
forks:>=205Matches warehouses with at least 205 replicas.
forks:<90Matches warehouses with less than 90 replicas.
forks:10.. 20Matches warehouses with 10 to 20 replicas.

3.6 Search by Number of stars

You can use the greater than, less than, and range qualifiers to search the warehouse based on the number of stars it has

qualifiers The sample
stars:n stars:500Matches warehouses with exactly 500 asterisks.
stars:10.. 20Matches warehouses with 10 to 20 asterisks and less than 1000 KB.
stars:>=500 fork:true language:vueMatches warehouses with at least 500 asterisks, including duplicated asterisks (written in VUE).

3.7 Search by warehouse creation time or last update time

You can filter the repository based on when it was created or when it was last updated.

  • forThe time when the warehouse was created, you can usecreatedA qualifier.
  • To understand theThe time when the warehouse was last updatedYou need to usepushedQualifiers.pushedThe qualifier returns a list of warehouses, sorted by the most recent commits on any branch of the warehouse.

Both take date as parameter. Date format must comply with ISO8601 standard, namely yyyY-MM-DD (year – month – day).

You can also add optional time THH:MM:SS+00:00 after the date to search by hour, minute, or second. This is T, followed by HH:MM:SS (hour – minute – second) and UTC offset (+00:00).

Dates support greater than, less than, and range qualifiers.

qualifiers The sample
created:YYYY-MM-DD vue created:<2020-01-01Matches warehouses with the word “VUE” that were created before 2020.
pushed:YYYY-MM-DD css pushed:>2020-02-01Matches warehouses with the word “CSS” that received a push after January 2020.
vue pushed:>=2020-03-06 fork:onlyMatches a repository with the word “vUE” that received a push on or after March 6, 2020 as a copy.

3.8 Search by Language

You can search the repository based on the main language in which it is written.

qualifiers The sample
language:LANGUAGE vue language:javascriptMatches a repository written in JavaScript with the word “vue”.

3.9 Search by Subject

You can find all the warehouses grouped under a particular topic.

qualifiers The sample
topic:TOPIC topic:algorithmMatches the repository that has been categorized as the “Algorithm” subject.

There are probably a lot of people who don’t know about GitHub.

3.10 Search by Topic Number

You can use the Topics qualifier and the greater than, less than, and scope qualifiers to search the repository by the number of topics applied to the repository.

qualifiers The sample
topics:n topics:5Matches a repository with five themes.
topics:>3Matches warehouses with more than three topics.

3.11 Using the visual interface to search

You can also search GitHub using the Search page or Advanced Search page.

This kind of search, probably even fewer people know it.

Advanced Search Page provides a visual interface for building search queries.

You can filter the search by various factors, such as the number of stars or replicas the repository has. When filling in the advanced search field, your query will be automatically built in the top search bar.

3.12 Search by permission

You can search the warehouse according to its permission. You must filter the warehouse by specific license or series of licenses using license keywords.

qualifiers The sample
license:LICENSE_KEYWORD License: apache 2.0Matches the repository authorized by the Apache License 2.0.

3.13 Search by Public or Private Warehouse

You can filter searches based on whether the repository is public or private.

qualifiers The sample
is:public is:public org:githubMatches public repositories owned by GitHub.
is:private is:private pagesMatches a private repository that you have access to and contains the word “Pages”.

3.14 Determine whether the Warehouse is mirrored

You can search for repositories based on whether they are mirrored and hosted elsewhere.

qualifiers The sample
mirror:true mirror:true GNOMEMatches the repository that is mirrored and contains the word “GNOME”.
mirror:false mirror:false GNOMEMatches the repository that is not mirrored and contains the word “GNOME”.

3.15 Search based on whether the warehouse has been archived

You can search a warehouse based on whether it has been archived.

qualifiers The sample
archived:true archived:true GNOMEMatches archived repositories that contain the word “GNOME”.
archived:false archived:false GNOMEMatches unarchived repositories that contain the word “GNOME”.

3.16 Based on havinggood first issue 或 help wantedTag the number of topics searched

You can use the qualifiers help-wanted-issues:>n and good-first-issues:>n to search for warehouses with a minimum number of issues labeled help-wanted or good-first-issue.

qualifiers The sample
good-first-issues:>n good-first-issues:>2 javascriptMatches have more than two labels forgood-first-issue“And contains the word “javascript” in the repository.
help-wanted-issues:>n help-wanted-issues:>4 reactMatches have more than four tags forhelp-wanted“And contains the word “React” in the warehouse.

4. More tips

In fact, many of the above content is from GitHub’s official documentation, if you want to learn more tips, check out GitHub’s official documentation

Making the Docs:

If you don’t know or can’t use GitHub yet, check out this section: Git and GitHub Learning Resources


The article is reproduced, the following is the original and the author of the author: Dawn night do link: juejin.cn/post/689105…

We hope this article will help you 🧠 feel free to leave your thoughts in the comments 🌊, we will discuss and share 🔥