Create, review, and merge GitHub Pull Requests from command line only
Now you can manage all the GitHub pull request workflows from using only the command line via it's [official CLI]. Use homebrew command to install on macOS.
brew install gh
gh pr create
You will be prompt to enter information such as PR title, description, then you'll get the PR number to view on web, or you can open on browser by using the
view command with
gh pr view -w
To review any pull requests, the first step is to checkout the code to review. You can get the PR number from web, or using this command to list all the PRs.
gh pr list Showing 1 of 1 open pull request in narze/thank-u-nextjs #1 feat: replace @tailwindcssinjs/macro with twin.macro twin-macro
Then checkout the code for reviewing.
gh pr checkout 1
After reviewing, take action to the PR, and choose to comment, approve, or request changes.
gh pr review ? What kind of review do you want to give? [Use arrows to move, type to filter] > Comment Approve Request changes
To merge a PR, simply use
gh pr merge, and choose the merge method.
gh pr merge ? What merge method would you like to use? [Use arrows to move, type to filter] > Create a merge commit Rebase and merge Squash and merge
Alternatively you can reject and close the PR without merging.
gh pr close
You can also use other subcommands like
alias, and many more. Type only
gh to see all available commands.