Back to list
moto-nrw

gh-cli

by moto-nrw

A German all day school supervision software

6🍴 2📅 Jan 24, 2026

SKILL.md


name: gh-cli description: GitHub CLI (gh) command reference and usage patterns. Use when working with GitHub from the command line - PRs, issues, repos, workflows, releases, and API calls.

GitHub CLI (gh) Reference

GitHub CLI brings GitHub to your terminal. Use gh for pull requests, issues, repos, workflows, and more.

Quick Start

# Authenticate
gh auth login

# Check status
gh auth status

Command Reference

Authentication (gh auth)

CommandDescription
gh auth loginAuthenticate with GitHub
gh auth logoutLog out of GitHub
gh auth refreshRefresh stored credentials
gh auth setup-gitConfigure git to use gh as credential helper
gh auth statusView authentication status
gh auth switchSwitch between accounts
gh auth tokenPrint or manage auth tokens

Pull Requests (gh pr)

CommandDescription
gh pr createCreate a pull request
gh pr listList pull requests
gh pr statusShow PR status for current branch
gh pr view [number]View PR details
gh pr checkout <number>Check out a PR branch
gh pr merge [number]Merge a PR
gh pr close [number]Close a PR
gh pr reopen [number]Reopen a PR
gh pr edit [number]Edit PR title, body, labels, etc.
gh pr comment [number]Add a comment
gh pr review [number]Submit a review
gh pr diff [number]View PR diff
gh pr checks [number]View CI check status
gh pr ready [number]Mark as ready for review
gh pr revert <number>Revert a merged PR
gh pr update-branchUpdate PR branch with base
gh pr lock/unlockLock/unlock conversation

Common PR workflows:

# Create PR interactively
gh pr create

# Create PR with title and body
gh pr create --title "Add feature" --body "Description here"

# Create draft PR
gh pr create --draft

# Merge with squash
gh pr merge --squash

# View PR in browser
gh pr view --web

Issues (gh issue)

CommandDescription
gh issue createCreate an issue
gh issue listList issues
gh issue statusShow issue status
gh issue view <number>View issue details
gh issue close <number>Close an issue
gh issue reopen <number>Reopen an issue
gh issue edit <number>Edit issue
gh issue comment <number>Add a comment
gh issue delete <number>Delete an issue
gh issue transfer <number>Transfer to another repo
gh issue develop <number>Create linked branch
gh issue pin/unpinPin/unpin issue
gh issue lock/unlockLock/unlock conversation

Common issue workflows:

# Create issue interactively
gh issue create

# Create with labels and assignee
gh issue create --title "Bug" --label "bug" --assignee "@me"

# List open bugs assigned to me
gh issue list --label "bug" --assignee "@me"

# Create branch from issue
gh issue develop 123 --checkout

Repositories (gh repo)

CommandDescription
gh repo createCreate a repository
gh repo clone <repo>Clone a repository
gh repo fork [repo]Fork a repository
gh repo view [repo]View repo details
gh repo list [owner]List repositories
gh repo editEdit repo settings
gh repo delete <repo>Delete a repository
gh repo rename <new-name>Rename a repository
gh repo syncSync fork with upstream
gh repo archive <repo>Archive a repository
gh repo unarchive <repo>Unarchive a repository
gh repo set-defaultSet default repository
gh repo deploy-keyManage deploy keys
gh repo autolinkManage autolinks
gh repo gitignoreView gitignore templates
gh repo licenseView license templates

Common repo workflows:

# Create new repo from current directory
gh repo create --source=. --push

# Create private repo
gh repo create my-project --private

# Clone and cd into repo
gh repo clone owner/repo -- --depth=1

# Sync fork with upstream
gh repo sync owner/fork

Workflows & Actions (gh workflow, gh run)

Workflows:

CommandDescription
gh workflow listList workflows
gh workflow view [id]View workflow details
gh workflow run <workflow>Trigger a workflow
gh workflow enable <workflow>Enable a workflow
gh workflow disable <workflow>Disable a workflow

Runs:

CommandDescription
gh run listList recent runs
gh run view [id]View run details
gh run watch [id]Watch run in real-time
gh run rerun [id]Re-run a workflow
gh run cancel [id]Cancel a run
gh run delete [id]Delete a run
gh run download [id]Download artifacts

Common workflow patterns:

# Trigger workflow with inputs
gh workflow run deploy.yml -f environment=staging

# Watch current branch's latest run
gh run watch

# Download artifacts from run
gh run download <run-id>

# Re-run failed jobs only
gh run rerun <run-id> --failed

Releases (gh release)

CommandDescription
gh release create <tag>Create a release
gh release listList releases
gh release view [tag]View release details
gh release edit <tag>Edit a release
gh release delete <tag>Delete a release
gh release download [tag]Download release assets
gh release upload <tag>Upload assets to release
gh release delete-assetDelete an asset
gh release verify <tag>Verify release authenticity
gh release verify-assetVerify asset authenticity

Common release patterns:

# Create release with auto-generated notes
gh release create v1.0.0 --generate-notes

# Create release with assets
gh release create v1.0.0 ./dist/*.tar.gz

# Download specific asset
gh release download v1.0.0 --pattern "*.tar.gz"

# Create draft release
gh release create v1.0.0 --draft

Search (gh search)

CommandDescription
gh search repos <query>Search repositories
gh search issues <query>Search issues
gh search prs <query>Search pull requests
gh search commits <query>Search commits
gh search code <query>Search code

Search examples:

# Find repos by topic
gh search repos --topic=cli --language=go

# Search issues across GitHub
gh search issues "memory leak" --state=open

# Search your PRs
gh search prs --author=@me --state=open

# Search code (requires auth)
gh search code "function authenticate" --repo=owner/repo

Codespaces (gh codespace / gh cs)

CommandDescription
gh cs createCreate a codespace
gh cs listList codespaces
gh cs codeOpen in VS Code
gh cs sshSSH into codespace
gh cs stopStop a codespace
gh cs deleteDelete a codespace
gh cs cpCopy files to/from codespace
gh cs portsManage port forwarding
gh cs logsView codespace logs
gh cs rebuildRebuild codespace
gh cs jupyterOpen Jupyter
gh cs viewView codespace details
gh cs editEdit codespace settings

Secrets & Variables (gh secret, gh variable)

Secrets:

CommandDescription
gh secret set <name>Set a secret
gh secret listList secrets
gh secret delete <name>Delete a secret

Variables:

CommandDescription
gh variable set <name>Set a variable
gh variable get <name>Get variable value
gh variable listList variables
gh variable delete <name>Delete a variable

Examples:

# Set secret from prompt
gh secret set API_KEY

# Set secret from file
gh secret set CERT < cert.pem

# Set environment secret
gh secret set API_KEY --env production

# Set org-level variable
gh variable set NODE_ENV --org my-org -v "production"

API (gh api)

Make authenticated requests to GitHub's REST or GraphQL API.

gh api <endpoint> [flags]

Key flags:

FlagDescription
-X, --methodHTTP method (GET, POST, etc.)
-f, --raw-fieldAdd string parameter
-F, --fieldAdd typed parameter
-H, --headerAdd HTTP header
-q, --jqFilter response with jq
-t, --templateFormat with Go template
--paginateFetch all pages
--slurpCombine paginated results
-i, --includeShow response headers

Placeholders: {owner}, {repo}, {branch} auto-populate from current repo.

Examples:

# Get current user
gh api user

# List repo issues
gh api repos/{owner}/{repo}/issues

# Create issue comment
gh api repos/{owner}/{repo}/issues/123/comments -f body="Comment text"

# GraphQL query
gh api graphql -f query='{ viewer { login } }'

# Paginate and filter
gh api repos/{owner}/{repo}/issues --paginate -q '.[].title'

# POST with JSON body
gh api repos/{owner}/{repo}/labels -f name=bug -f color=ff0000

Other Commands

CommandDescription
gh browseOpen repo/issue/PR in browser
gh statusShow GitHub status for repos you care about
gh gist createCreate a gist
gh gist listList your gists
gh gist viewView a gist
gh gist editEdit a gist
gh gist cloneClone a gist
gh gist deleteDelete a gist
gh label createCreate a label
gh label listList labels
gh label editEdit a label
gh label deleteDelete a label
gh label cloneClone labels from another repo
gh project createCreate a project
gh project listList projects
gh project viewView project details
gh project editEdit a project
gh project closeClose a project
gh project deleteDelete a project
gh cache listList workflow caches
gh cache deleteDelete workflow caches
gh ssh-key addAdd SSH key
gh ssh-key listList SSH keys
gh ssh-key deleteDelete SSH key
gh gpg-key addAdd GPG key
gh gpg-key listList GPG keys
gh gpg-key deleteDelete GPG key
gh org listList organizations
gh ruleset listList rulesets
gh ruleset viewView ruleset details
gh attestation verifyVerify artifact attestation
gh alias setCreate command alias
gh alias listList aliases
gh alias deleteDelete alias
gh config setSet configuration
gh config getGet configuration
gh config listList configuration
gh extension installInstall extension
gh extension listList extensions
gh extension upgradeUpgrade extensions
gh extension removeRemove extension
gh completionGenerate shell completions

Global Flags

These work with most commands:

FlagDescription
-R, --repo [HOST/]OWNER/REPOTarget a specific repository
--helpShow help
--versionShow version

Environment Variables

VariableDescription
GITHUB_TOKENAuth token (alternative to gh auth login)
GH_TOKENSame as GITHUB_TOKEN
GH_HOSTGitHub hostname (for GHES)
GH_REPODefault repository
GH_EDITOREditor for composing text
GH_BROWSERBrowser for opening URLs
GH_PAGERPager for output
NO_COLORDisable color output

Tips

  1. Use --web or -w to open in browser: gh pr view --web
  2. Use @me for current user: gh issue list --assignee @me
  3. Use jq filtering for JSON output: gh api user -q '.login'
  4. Tab completion - run gh completion and follow instructions
  5. Aliases - create shortcuts: gh alias set pv 'pr view'
  6. Extensions - extend functionality: gh extension install owner/repo

Resources

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon