Github CLI
Repos
Creating a Repo
gh repo create
: Create a new repository on GitHub.
- Add
--public
,--private
, or--internal
for visibility. - Use
--source .
to push an existing local repository. --add-readme
and--add-gitignore
can initialize files.
Issues
Listing Issues
gh issue list
: List issues in the current repository.
--assignee <username>
: Filter by assignee.--state {open|closed|all}
: Filter by state.--label <label_name>
: Filter by label.--milestone <milestone_name>
: Filter by milestone.
Creating an Issue
gh issue create
: Create a new issue.
--title "Issue Title"
: Set the issue title.--body "Issue description"
: Add a detailed body.--assignee <username>
: Assign an individual.--label <label_name>
: Apply labels.--milestone <milestone_name>
: Link to a milestone.--web
: Open in a web browser to create.
Viewing an Issue
gh issue view <issue_number>
: View details of a specific issue.
--web
: Open the issue in your web browser.
Pull Requests
Listing Pull Requests
gh pr list
: List pull requests in the current repository.
--state {open|closed|merged|all}
: Filter by state.--assignee <username>
: Filter by assignee.--author <username>
: Filter by author.--base <branch_name>
: Filter by base branch.--head <branch_name>
: Filter by head branch.
Creating a Pull Request
gh pr create
: Create a new pull request.
--title "PR Title"
: Set the PR title.--body "PR description"
: Add a detailed body.--base <branch_name>
: Specify the base branch (default:main
).--head <branch_name>
: Specify the head branch (default: current branch).--draft
: Create a draft pull request.--reviewer <username>
: Request reviews.--web
: Open in a web browser to create.
Viewing a Pull Request
gh pr view <pr_number>
: View details of a specific pull request.
--web
: Open the pull request in your web browser.--comments
: Show comments.--files
: Show changed files.gh pr checkout <pr_number>
: Checkout a pull request as a local branch.