Skip to content
gh - github cli

gh - github cli

install github-cli

brew install gh

configure options

the config is stored in ~/.config/gh/config.yml

set pager

gh config set pager cat

configure editor

gh config set editor "code --wait"

github stars

list all starred repos

GH_PAGER="" gh api user/starred --paginate --jq '.[].full_name'

removed starred repo

turns out, you can’t unstar a repo on the web which was taken down by a DMCA request

gh api -X DELETE user/starred/username/repo

manage pull requests

list pull requests

gh pr list

(squash) merge and delete remote branch

replace 23 with your pr id

gh pr merge 23 --auto -s -d

close without merging and delete remote branch

replace 42 with your pr id

gh pr close 42 -d

list repositories without a description

list all your own repos which are not archived and are missing a description

gh repo list --source --no-archived -L 1000 \
  --json nameWithOwner,description \
  --jq '.[] | select((.description == null) or (.description == "")) | .nameWithOwner'