DevTools

Cheatsheet GitHub CLI

Ferramenta de linha de comandos oficial do GitHub

Volver a los lenguajes
GitHub CLI
22 tarjetas encontradas
Categorías:
Versiones:

Autenticação


3 cards
Login
gh auth login
gh auth status
gh auth token
gh auth refresh -s repo,read:org

Autenticarse en GitHub.

Configuración
gh config set editor vim
gh config set git_protocol ssh
gh config list
gh alias set co 'pr checkout'

Configurar preferencias.

Múltiples cuentas
gh auth login --hostname github.com
gh auth switch
gh auth status --show-token

Gestionar cuentas.

Repositórios


4 cards
Crear repositorio
gh repo create my-project --public
gh repo create --private --clone
gh repo create org/project --template base

Crear repos en GitHub.

Clonar y fork
gh repo clone user/repo
gh repo fork user/repo --clone
gh repo view --web

Obtener repositorios.

Listar y ver
gh repo list
gh repo list --language=php
gh repo view user/repo
gh repo set-default

Explorar repositorios.

Gestionar repo
gh repo edit --description "Nueva desc"
gh repo rename nuevo-nombre
gh repo delete user/repo --yes
gh repo archive user/repo

Modificar repositorios.

Pull Requests


4 cards
Crear PR
gh pr create
gh pr create --title "Fix bug" \
  --body "Descripción" --draft
gh pr create --base main --head feature

Crear pull request.

Listar y ver
gh pr list
gh pr list --state merged
gh pr view 42
gh pr view 42 --web
gh pr diff 42

Explorar PRs.

Checkout y merge
gh pr checkout 42
gh pr merge 42 --squash
gh pr merge 42 --rebase
gh pr merge 42 --merge --delete-branch

Trabajar con PRs.

Review
gh pr review 42 --approve
gh pr review 42 --request-changes \
  --body "Corregir X"
gh pr review 42 --comment
gh pr checks 42

Revisar pull requests.

Issues


3 cards
Crear issue
gh issue create
gh issue create --title "Bug" \
  --body "Descripción" --label bug
gh issue create --assignee @me

Crear issues.

Listar y filtrar
gh issue list
gh issue list --label bug --state open
gh issue list --assignee @me
gh issue list --search "texto"

Filtrar issues.

Gestionar 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 "¡Hecho!"

Modificar issues.

Actions


4 cards
Listar workflows
gh workflow list
gh workflow view ci.yml
gh run list --workflow=ci.yml
gh run list --limit 5

Ver workflows y runs.

Ver runs
gh run view 12345
gh run view 12345 --log
gh run view 12345 --log-failed
gh run watch 12345

Inspeccionar ejecuciones.

Trigger y re-run
gh workflow run ci.yml
gh workflow run ci.yml -f param=val
gh run rerun 12345
gh run rerun 12345 --failed

Ejecutar workflows.

Logs y artefactos
gh run download 12345
gh run download 12345 -n artifact-name
gh cache list
gh cache delete --all

Descargar resultados.

Avançado


4 cards
Gists
gh gist create archivo.txt --public
gh gist list
gh gist view GIST_ID
gh gist edit GIST_ID

Gestionar gists.

Releases
gh release create v1.0.0
gh release create v1.0.0 dist/* \
  --title "Release 1.0" \
  --notes "Changelog aquí"
gh release list
gh release download v1.0.0

Gestionar releases.

API directa
gh api repos/user/repo
gh api graphql -f query='{ viewer { login } }'
gh api repos/user/repo/issues \
  --paginate --jq '.[].title'

Acceder a la API de GitHub.

Extensiones
gh extension install dlvhdr/gh-dash
gh extension list
gh extension remove gh-dash
gh dash  # dashboard TUI

Extender con extensiones.