CI/CD
GitHub CLI
GitHub CLI commands for repository and PR management.
39 commands
Windows
MacOS
Linux
#github
#version-control
#Popular
Repository
Create a new public repository
gh repo create myrepo --public
Clone a repository
gh repo clone owner/repo
Fork a repository to your account
gh repo fork owner/repo
Open repository in the browser
gh repo view owner/repo --web
List your repositories
gh repo list --limit 20
Archive a repository
gh repo archive owner/repo
Pull Requests
Create a pull request
gh pr create --title "Fix bug" --body "Details"
List open pull requests
gh pr list
View pull request details
gh pr view 42
Check out a pull request branch locally
gh pr checkout 42
Squash merge a pull request
gh pr merge 42 --squash
Approve a pull request
gh pr review 42 --approve
Show the diff of a pull request
gh pr diff 42
Close a pull request without merging
gh pr close 42
Issues
Create a new issue
gh issue create --title "Bug report" --body "Steps"
List open issues
gh issue list
View issue details
gh issue view 10
Close an issue
gh issue close 10
Reopen a closed issue
gh issue reopen 10
Add a label to an issue
gh issue edit 10 --add-label bug
Releases
Create a new release
gh release create v1.0.0 --title "v1.0.0" --notes "Initial release"
List all releases
gh release list
Download release assets
gh release download v1.0.0
View release details
gh release view v1.0.0
Delete a release
gh release delete v1.0.0 --yes
Actions
List recent workflow runs
gh run list
View details of a workflow run
gh run view 12345
Watch a running workflow in real time
gh run watch 12345
Re-run a failed workflow
gh run rerun 12345
List all workflows in the repository
gh workflow list
Manually trigger a workflow
gh workflow run deploy.yml
Gist
Create a public gist from a file
gh gist create file.txt --public
List your gists
gh gist list
View a gist by ID
gh gist view GIST_ID
Edit an existing gist
gh gist edit GIST_ID
Delete a gist
gh gist delete GIST_ID
Quick Commands
Create a new pull request from the current branch
gh pr create --title "Fix bug" --body "Details"
List recent GitHub Actions workflow runs
gh run list
Clone a GitHub repository locally
gh repo clone owner/repo