Cheatsheet GitHub CLI
Ferramenta de linha de comandos oficial do GitHub
GitHub CLI
22
cards found
Categories:
Versions:
Authentication
Login
gh auth login
gh auth status
gh auth token
gh auth refresh -s repo,read:org
Authenticate with GitHub.
Configuration
gh config set editor vim
gh config set git_protocol ssh
gh config list
gh alias set co 'pr checkout'
Configure preferences.
Multiple Accounts
gh auth login --hostname github.com
gh auth switch
gh auth status --show-token
Manage accounts.
Repositories
Create Repository
gh repo create my-project --public
gh repo create --private --clone
gh repo create org/project --template base
Create repos on GitHub.
Clone and Fork
gh repo clone user/repo
gh repo fork user/repo --clone
gh repo view --web
Get repositories.
List and View
gh repo list
gh repo list --language=php
gh repo view user/repo
gh repo set-default
Explore repositories.
Manage Repo
gh repo edit --description "New desc"
gh repo rename new-name
gh repo delete user/repo --yes
gh repo archive user/repo
Modify repositories.
Pull Requests
Create PR
gh pr create
gh pr create --title "Fix bug" \
--body "Description" --draft
gh pr create --base main --head feature
Create a pull request.
List and View
gh pr list
gh pr list --state merged
gh pr view 42
gh pr view 42 --web
gh pr diff 42
Explore PRs.
Checkout and Merge
gh pr checkout 42
gh pr merge 42 --squash
gh pr merge 42 --rebase
gh pr merge 42 --merge --delete-branch
Work with PRs.
Review
gh pr review 42 --approve
gh pr review 42 --request-changes \
--body "Fix X"
gh pr review 42 --comment
gh pr checks 42
Review pull requests.
Issues
Create Issue
gh issue create
gh issue create --title "Bug" \
--body "Description" --label bug
gh issue create --assignee @me
Create issues.
List and Filter
gh issue list
gh issue list --label bug --state open
gh issue list --assignee @me
gh issue list --search "text"
Filter issues.
Manage Issues
gh issue view 10
gh issue close 10 --reason completed
gh issue reopen 10
gh issue edit 10 --add-label urgent
gh issue comment 10 --body "Done!"
Modify issues.
Actions
List Workflows
gh workflow list
gh workflow view ci.yml
gh run list --workflow=ci.yml
gh run list --limit 5
View workflows and runs.
View Runs
gh run view 12345
gh run view 12345 --log
gh run view 12345 --log-failed
gh run watch 12345
Inspect runs.
Trigger and Re-run
gh workflow run ci.yml
gh workflow run ci.yml -f param=val
gh run rerun 12345
gh run rerun 12345 --failed
Run workflows.
Logs and Artifacts
gh run download 12345
gh run download 12345 -n artifact-name
gh cache list
gh cache delete --all
Download results.
Advanced
Gists
gh gist create file.txt --public
gh gist list
gh gist view GIST_ID
gh gist edit GIST_ID
Manage gists.
Releases
gh release create v1.0.0
gh release create v1.0.0 dist/* \
--title "Release 1.0" \
--notes "Changelog here"
gh release list
gh release download v1.0.0
Manage releases.
Direct API
gh api repos/user/repo
gh api graphql -f query='{ viewer { login } }'
gh api repos/user/repo/issues \
--paginate --jq '.[].title'
Access the GitHub API.
Extensions
gh extension install dlvhdr/gh-dash
gh extension list
gh extension remove gh-dash
gh dash # TUI dashboard
Extend with extensions.