10

I have a public GitHub repository.

Someone submitted a pull request.

I would like to test and edit pull request in Visual Studio Code and push suggested edits to existing pull request so they can be discussed and merged on GitHub.

I use Visual Studio Code as my code editor, but question isn’t specific to Visual Studio Code.

Is this possible using git command?

0

2 Answers 2

7

Since the Pull Request is from a fork, you can’t push changes to the PR yourself unless you also have access to the fork, or the PR creator grants you permission. You can make suggestions in a PR review though.

However, you can check out and test the PR yourself using git:

git fetch origin refs/pull/2/head:pr/2 git checkout pr/2 

Source: GitHub clone from pull request?

Sign up to request clarification or add additional context in comments.

Comments

4

I have to admit that I never tried it, but as far as I could see, you need to:

  1. Install the GitHub Pull Requests and Issues from the Marketplace.
  2. Select your pull request from the list within Visual Studio Code.
  3. Click "Checkout".
  4. Review the pull request and finish your review.

There is also a cool demo on the code.visualstudio.com blog .

5 Comments

Thanks for sharing Christian! Is it possible to do this using git alone?
No idea what you mean by git alone. You asked about Visual Studio Code and Github, I just found another great feature, which I will try tomorrow: Creating Pull Requests :)
Oh… sorry for confusion… I updated question. I am asking about editing PR using desktop code editor vs GitHub PR web editor.
Oh ok, so my answer is outdated now. Sorry, for not being able to help. Working with Git/GitHub and pulll requests for a few years now. Afaik, you can only push commits to the branch for which the pull request has been created, and you cannot submit suggestions using git. Any suggestions and originally included code gets overwritten/outdated. Interested in hearing other people's thoughts.
How about for forked repo? I mean if someone creates a PR from his forked repo to my main repo, how can I review directly from my vscode?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.