3 ms·
Most pull requests are from forks of a repo. What's the single command with git to add the others repository and checkout the branch related to the PR? gh pr c
by mfer 4y ago
Most pull requests are from forks of a repo. What's the single command with git to add the others repository and checkout the branch related to the PR?
gh pr checkout 123
That's just for convienance. It does a few things...
1) looks up the pull request to find the proper repository and branch on it.
2) adds the repository if not already added
3) checks out the branch the PR is based on
How would you do that with just git?
I see gh pr checkout as a convenience. It just makes it less work.
- nagisa 4y agoNot a single command, but looking up other repositories is not necessary. Pull requests will create refs in the repository against which the PR was created, which you can then fetch. git fetch origin refs/pull/123/head git checkout FETCH_HEAD This is actually somewhat preferable to me, because I don't always want to _checkout_ the PR. For example if I’m looking to integrate it into my branch via the CLI, its a git fetch origin refs/pull/123/head git merge --ff-only (or whatever) FETCH_HEAD