As the end of the year rapidly approaches, I've been reflecting and looking for ways to increase my productivity in the next year.
For some time I've been considering integrating GitHub CLI in my workflow, aiming to reduce the back and forth between the terminal and the GitHub web UI.
Since I interact with pull requests pretty much everyday, several times a day, that's where I'll focus mainly.
Listing some useful commands below for reference.
Open repository in the web browser
gh browse
List open PRs
gh pr list
Get status of relevant PRs
gh pr status
View PR in the browser
gh pr view --web
Checkout a PR
gh pr checkout
Accepts PR number or branch name.
Create a PR
gh pr create
It's also possible to skip the interactive PR creation, by directly specify the title and body:
gh pr create --title "PR title" --body "PR body"
Other options:
- To mark PR as draft use option
-d
. - To open the web browser to create the PR use option
-w
.
Close PR
gh pr close
Other options:
- To leave a closing comment use option
-c
. - To delete the local and remote branch after close use option
-d
.
The entire list of available commands and respective documentation can be found here.