Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's worth installing the CLI just for a single command:

`gh pr create --web`

Saves me having to push my current branch, navigate to the repo page, hit the "create PR" button, etc.



These days when I push a branch, github gives a URL in the response that I can click from the terminal to open a PR. It is indeed very good.


That is pretty nice.

I've been doing `git push -u origin HEAD` and then using my mouse to click on the "go here to create a PR" link that gets printed, which isn't too bad. Takes you right to the page where you can review the changeset before opening the PR. If I'm not actually ready to open a PR by the time I push upstream, I just open a draft instead.


Yes, that's what I do as well. I also have the old hub frontend for git installed. The idea is that you simply alias git to hub and then you get a few extra commands.

My favorite is "git browse", which opens a browser for the current repo & branch. There are a few other commands that are probably useful but that I don't really do much with.


This is one of my favourites, too! And combined with the alias functionality, you can do

    gh alias set pcw 'pr create --web'
and then just use

    gh pcw
to create a new PR. There's also sufficient smarts around forking or not, depending on write permissions on the upstream repo.


Do you run this command frequently enough to do an alias? I feel like it'd be better to just have the muscle memory of typing the actual command instead


Probably a few times a day? One nice thing about the alias is that it expands and takes more parameters if you want, like

    gh pcw --base=development
It's also super quick to set up an alias, so I don't see why not.


I used to have a lot of git aliases but then I became dependent on those and forgot the actual git commands that were lying underneath. So whenever I went to a new system I'd have to port my dotfiles or look up the git docs for what the commands were. If a colleague asked me "how do I do X" I had no clue and had to look in my bashrc. Nowadays I only add them if I do it many many times per day. Like "git commit -a -m" for example. I try to keep things as close to stock as I can

This type of alias seems on the fence for me, if was like 10x a day I'd definitely be on board but a few times a day is a gray area


Yeah this is huge— I used to use `hub` for this one thing as well. The alternative is even worse if you cloned from a repo you don't have push access to, so your first step is going to the web UI, creating the fork, switching the remote on your clone, and then _finally_ pushing and creating the PR.


Thanks for this, will start using it.


This is the main reason I'm installing - I can build this into my editor pretty easily.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: