Refined-github: Bring back CLI instructions for checking out PRs

Created on 7 Jan 2018  路  7Comments  路  Source: sindresorhus/refined-github

I'm talking about Step 1 in the section that comes up if you click 'view command line instructions' at the bottom of PRs. I just moved to a new laptop where I don't have hub installed yet and had to discover that checking out PRs without it is surprisingly cumbersome 馃槄

PR checkout instructions

Using this box, you just have to click the copy button and paste it into the terminal to check out a PR locally. Maybe we can bring it back somehow, perhaps just have the copy button at the top of PRs without showing the commands.

change request good first issue help wanted

Most helpful comment

I suggested to @sindresorhus to restore this but update the instructions to use hub instead, so newcomers aren't left out in the cold and they'll learn about hub.

All 7 comments

I just moved to a new laptop where I don't have hub installed yet

Install it then? You only do it once.

This makes sense for a maintainer of a public repo, but it doesn't really help most other scenarios including most teams working on private/public repos where they'd probably work in one repository where just git checkout <branch name> would work.

There's a 3rd way as well - GitHub exposes PRs as additional refs which you can instruct git to download and then you can checkout PRs by their number without hub and doesn't matter if the PR is open or not. It's actually listed in GitHub help doc: https://help.github.com/articles/checking-out-pull-requests-locally/#modifying-an-inactive-pull-request-locally

git fetch origin pull/ID/head:BRANCHNAME
git checkout BRANCHNAME

I actually prefer that approach if we are to advertise command-line instructions.


However, it's not useful to the majority of power users. They'd usually need it once or twice, then they'd forget about it and only then they'd install RG after they have created aliases, installed hub or just remembered what to type.

I just thought it'd be a useful feature for people who don't use hub.

There's a 3rd way as well

I actually used this approach for a while before I discovered hub, problem is that you can't push to these branches to update the PR so I'd prefer GitHub's recommended approach.

Speaking of hub, this is now my favorite fish autocomplete:

hub checkout (pbpaste)

I suggested to @sindresorhus to restore this but update the instructions to use hub instead, so newcomers aren't left out in the cold and they'll learn about hub.

I mean, it's fine for you guys to think it is not needed, but a fair share of people disagree. A lot of whom won't even want to use a 3rd party tool (hub). A lot of who deal with git inside remote servers and docker containers where it might not be possible or very inconvenient to install hub. So, at least it should be made configurable where I can disable the "feature" of hiding command line instruction. I had to disable the extension because I regularly review and check PRs from forks, and I want to use this extension.

I am down to sending a PR if you want

This change would make it disableable https://github.com/sindresorhus/refined-github/issues/963#issuecomment-468278578

Was this page helpful?
0 / 5 - 0 ratings