Integrating GitHub CLI in my workflow
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 browseList open PRs
gh pr listGet status of relevant PRs
gh pr statusView PR in the browser
gh pr view --webCheckout a PR
gh pr checkoutAccepts PR number or branch name.
Create a PR
gh pr createIt’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 closeOther 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.