DEV Community

Tech Tim (@TechTim42)
Tech Tim (@TechTim42)

Posted on • Originally published at Medium

GitHub CLI: Your Secret Weapon for Slaying Code Reviews

a screenshot for github cli

Hey there, fellow coders! You know what’s worse than getting feedback on your code? Having to switch between multiple tabs and tools just to make a pull request. It’s a real pain, right? But fear not, my friends! I’m here to introduce you to GitHub CLI — the fun and easy way to improve your code quality in just five minutes.

Create pull requests with ease:

Creating pull requests can be a pain, but with GitHub CLI, you can create them from the comfort of your command line. No more switching between browser tabs and copy-pasting information! You can create a pull request with just a few commands, like this:

gh pr create --title "Added new feature" --body "This feature will improve user experience" --assignee @joh

Request code reviews:

Requesting code reviews is essential to ensure that your code is up to par. With GitHub CLI, you can request reviews from your peers without leaving your command line. You can even specify a due date for the review, so everyone knows when to get it done. Here’s an example command:

gh pr request-review --reviewer @jane --due-date 2023-03-21

Check pull request status:

You don’t want to be the person who constantly checks the pull request page to see if anything has changed. GitHub CLI makes it easy to check the status of your pull requests directly from your command line. Here’s how you can do it:

gh pr list --state open

This will list all of your open pull requests, along with some essential information like the title, author, and state.

Respond to code review comments:

Code review comments are essential for improving your code quality, but they can be overwhelming to keep track of. GitHub CLI allows you to respond to code review comments directly from your command line. Here’s how you can do it:

gh pr review 123 --comment "Thanks for the suggestion, I'll make that change"`

This command allows you to respond to a specific comment on a pull request.

Merge pull requests:

When your code has been reviewed and approved, it’s time to merge it into the main branch. GitHub CLI allows you to do this directly from your command line, without ever leaving your cozy terminal. Here’s how you can do it:

gh pr merge 123

This command merges the pull request with ID 123 into the main branch.

In the end

In a nutshell, GitHub CLI is a lifesaver for developers who want to streamline their code review process. It’s like having a superpower that allows you to create pull requests, request code reviews, check pull request status, respond to code review comments, and merge pull requests — all from the comfort of your command line. So next time you’re about to submit a pull request, remember to channel your inner superhero and use GitHub CLI to save time, improve your code quality, and have fun while doing it!

Top comments (0)