loading...
Cover image for 3 Things You Should Know About gh

3 Things You Should Know About gh

kojikanao profile image Koji (he/him) ・2 min read

Photo by Yancy Min on Unsplash

gh has been released.
In this article, I would like to introduce 3 things you should know when you use it.

1. gh pr has diff but it's not useful as well as web

gh pr has diff command that shows us differences between a new PR and master. However, it only has a color option, so all diffs are listed on the same window which is hard to review if the change has many lines. So I think right now, gh pr diff is for a small change.

The following is a diff when I added a new markdown file.

$ gh pr diff

2. Can not approve of our own PR

gh pr has review command that allows us to review a PR and give comment, approval, request change which is very useful. However, we can not approve of our own PR.
This functionality totally makes sense to team development.

$ gh pr review 1
? What kind of review do you want to give? Approve
? Review body <Received>
? Submit? Yes
failed to create review: Can not approve your own pull request

3. Default Editor isnano

gh sets nano as default editor.
I don't use nano, but use vim on Terminal. Also, use VSCode.
I'm using VScode for gh because VScode has a preview function for markdown. So, it is helpful to edit a new PR's body when I open a new PR.

$ gh config set editor "code --wait"

# vim
$ gh config set editor vim

Discussion

pic
Editor guide