microsoft / vscode-pull-request-github

GitHub Pull Requests for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github
MIT License
2.32k stars 579 forks source link

Local pull request branches does not include pull requests created beforehand #1070

Open adrinjalali opened 5 years ago

adrinjalali commented 5 years ago

Local pull request branches only shows the ones checked out or created from the extension. It doesn't show all the pull requests for which there is already a local branch, but created manually.

An alternative would be to allow "matching" or "assigning" a PR to a local branch maybe?

TBBle commented 4 years ago

It seems you can manually add a github-pr-owner-number to the branch definition in your .git/config to make it show up there, e.g.:

github-pr-owner-number = "moby#moby#41638"

for PR 41638 from https://github.com/moby/moby/

That's the same annotation the extension uses to record branches it creates when you "Checkout a Pull Request'. See associateBranchWithPullRequest and some related code comments for details.

It certainly seems feasible to have the extension also recognise branches whose upstream is a branch for a PR.

One problem might be that if multiple branches have the same github-pr-owner-number value, it seems to stop showing them in the UI and report errors.

maelvls commented 3 years ago

One-liner to set the correct github-pr-owner-number (requires gh):

git config branch.$(git branch --show-current).github-pr-owner-number \
  "$(gh pr view --json url | jq -r .url | sed 's@https://github.com/@@; s@/pull/@#@; s@/@#@g')"

Also, see: