3 ms·
> "gh pr" runs several git commands (5 to be exact): Only the first two are actually important though (the rest smell like an antifeature to me in fact). I hav
by seba_dos1 4y ago
> "gh pr" runs several git commands (5 to be exact):
Only the first two are actually important though (the rest smell like an antifeature to me in fact). I have them both as a single `git pr <remote> <PR>` alias:
[alias]
pr = !sh -c 'git fetch $1 pull/$2/head:pr-$1-$2 && git checkout pr-$1-$2' -
...and an equivalent for GitLab:
[alias]
mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -
You could easily hardcode remote to be "origin" and get what `gh` does.
- arp242 4y ago> the rest smell like an antifeature to me in fact I believe without it you can't push to a PR? As a maintainer, I find it quite useful: if a PR is essentially fine but needs a minor/trivial edit (typo, maybe add a few lines of documentation, extremely minor code style changes) then I typically just make then myself as I don't want to bother the submitter for that. Faster and easier for me, faster and easier for them. Either way, of course all of this is possible without the "gh" tool – no one claimed it's not, – but it's a lot easier than "stick these commands in your git config", especially for people not well versed in git.
- seba_dos1 4y agoOf course you can. You can always use the long form, or set it up explicitly - I sometimes do that too as a maintainer. Setting this up by default when you just want to checkout means that it's easy for you to push things to other people's repos by accident.