GitHub CLI brings the GitHub to the terminal1. GitHub CLI & hub.
brew install gh
-
# list of prs involving me gh search prs --state=open --involves=@me # search by PR title gh pr list -S "state:open type:pr in:name IPM" # looking for things related to me gh pr list -S "is:open type:pr involves:@me" # view PR using a pager PAGER=less gh pr view 13992 gh api <endpoint> [flags]- https://cli.github.com/manual/gh_api
--hostname <string>- the GitHub hostname for the request (default “github.com”)
-
gh api graphql -F owner='{owner}' -F name='{repo}' -f query=' query($name: String!, $owner: String!) { repository(owner: $owner, name: $name) { releases(last: 3) { nodes { tagName } } } } '
gh auth logingh repo --helpgh issue creategh issue listgh label list [flags]gh label list --sort namegh label list --search bug
gh pr- https://cli.github.com/manual/gh_pr
-R,--repo <[HOST/]OWNER/REPO>- select another repository using the [HOST/]OWNER/REPO format
gh pr list[flags]- https://cli.github.com/manual/gh_pr_list
-a,--assignee <string>-A,--author <string>-L,--limit <int>-S,--search <query>-s,--state <string>- filter by state:
{open|closed|merged|all}
- filter by state:
gh pr creategh pr view [<number> | <url> | <branch>] [flags]-c,--comments- view pull request comments
gh pr review[<number> | <url> | <branch>] [flags]-a,--approve-b,--body <string>- specify the body of a review
-c,--comment-r,--request-changes
- https://cli.github.com/manual/gh_pr
-
# ALIAS gh alias set all-with-me 'search prs --state=open --involves=@me' gh alias set with-me 'pr list -S "is:open type:pr involves:@me"'
GitHub Search Queries
GitHub Search Tips
to exclude something prepend a hyphen (-):
foo_library -repo:owner1/repoX -repo:owner2/repo
- basic
is:issueis:openis:publicis:privatelabel:beginnertype:issuetype:prno:projectno:milestoneno:labelno:assignee
-
further more...
- find by people
involves:octocatauthor:octocatuser:octocatcommenter:octocatanswered-by:octocatassignee:octocat
- find by content through name, description/readme, and so on
in:namein:titlein:descriptionin:readmein:topicin:bodyin:comments
- find by date:
YYYY-MM-DD- use
<,>,>=,<=and.. created:<2022-10-01updated:>2022-10-01merged:>=2022-10-01closed:<=2022-10-01closed:2024-05-01..2024-05-09
- use
- find numbers through stars, forks, and so on
- to further narrow your search use:
<,>,<=,>=&.. stars:nstars:1000forks:nforks:<100comments:n
- to further narrow your search use:
- miscellaneous
org:freecodecamplanguage:LANGUAGElanguage:PHPlicense:LICENSE_KEYWORDlicense:MITin:path user.rborfilename:user.rbsort:reactions-+1-descstate:opendraft:false
- additional resources:
- find by people