cli / cli/cli

`pr fetch` command

Open
#9,533 1 comment 1 reaction 0 assignees View on GitHub
enhancement needs-triage
Dominant language
Go
Stars
46.3k
Forks
9k
Avg merge
2d 9h
Merged PRs (30d)
89

Description

### Fetching pull requests without checking them out

Usually I work with development branches and merge pull requests directly to them for testing. Most of the time, it is not necessary to actually check out the branch into a work tree, I can just merge it directly. However the GitHub CLI tool always checks out the branch.

### Proposed solution

[It is possible][1] to do this manually:

```shell
git fetch origin pull/PR-NUMBER/head:BRANCH-NAME
```

It is very annoying though since I need to look up the user and branch name and name the branch myself. It would be far more convenient to be able to run something like:

```shell
gh pr fetch PR-NUMBER
```

To simply fetch the `PR-NUMBER` pull request into a local branch in the `-` format.

[1]: https://stackoverflow.com/a/30584951

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.