Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git request code review from command line git pull

I am using our shared repository, when i need to merge my changes in, I have to request a merge pull request from github page,which will be checked be a reviwer before it can be pushed up.

A simple git pull from the command line results in :

remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: At least one approved review is required by reviewers with write access.

Example:

I have a local master, and a local feature branch

I checkeout master, I pull in changes from feature branch

Now local master is behind the origin master by 1 commit

I want to push to master, i use git push

I receive the error below, this is because we a have review policy on the repository.

Can I request a pull request via command line?

like image 265
Harry Avatar asked Oct 29 '25 09:10

Harry


1 Answers

With the recent cli/cli (GitHub command line), you can:

  • mark a PR ready for review

  • review, approve and merge a PR, all from the command-line!

For instance:

$ gh pr checkout 123
$ gh pr diff
$ gh pr review --approve -b "lgtm"
$ gh pr merge

Note: GitHub CLI 2.4.0 (Dec. 2021) adds:

pr merge: allow editing commit subject

like image 198
VonC Avatar answered Oct 31 '25 00:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!