Skip to content

Instantly share code, notes, and snippets.

@fbakhda
Created November 21, 2024 06:48
Show Gist options
  • Save fbakhda/939cb522446f06484338ee564c7d57df to your computer and use it in GitHub Desktop.
Save fbakhda/939cb522446f06484338ee564c7d57df to your computer and use it in GitHub Desktop.
Github gh Command Samples
# Authentication
gh auth login
gh auth logout
# Repositories
gh repo clone owner/repo
gh repo create my-new-repo --public
gh repo fork owner/repo
gh repo view owner/repo --web
# Branches
gh repo clone owner/repo --branch my-branch
gh pr checkout 123
# Issues
gh issue list
gh issue create --title "Bug report" --body "Description of the bug"
gh issue view 123
# Pull Requests
gh pr list
gh pr create --title "New Feature" --body "Description of the feature" --base main --head feature-branch
gh pr view 456
gh pr merge 456
gh pr merge 456 --merge
gh pr merge 456 --squash
gh pr merge 456 --rebase
# Gists
gh gist list
gh gist create myfile.txt --public
gh gist view abc123
# Notifications
gh notifications
# General Help
gh help repo
# Approve a pull request
gh pr review --approve <PR_NUMBER>
# Request changes on a pull request
gh pr review --request-changes <PR_NUMBER> --body "Please address the following issues..."
# Comment on a pull request
gh pr review --comment <PR_NUMBER> --body "Looks good, but I have a few questions."
# Review a pull request interactively
gh pr review <PR_NUMBER>
# Assign people to review a pull request
gh pr review --reviewer <username1>,<username2> <PR_NUMBER>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment