Managing a Github Pull Request in The Visual Studio Using Git And Github Extension
Published Nov 18 2020 06:24 AM 11.8K Views
Microsoft

Normally we always need to test the whole set of code before accepting a git pull request, in this article we will try to understand the best approach to deal with pull requests and test them locally.

 

First, we need to get and setup visual studio github extension https://visualstudio.github.com/ we won’t go through the way of setting up it, because this process is very well documented and just start from creating a pull request in the visual studio:

 

image--000.jpg

 

Pull request is being created based on the branch in this case I took movingtoRC one as I want ask someone to check my changes and confirm that I can merge them to the main one:

 

image--001.jpg

 

As we have now our pull request ready, we can see that it received an identifier #6

 

image--002.jpg

 

Let’s get this pull request as a branch locally with

 

git fetch origin

 

image--003.jpg

And checkout it locally

 

image--004.jpg

Active branch is now TEST

 

image--005.jpg

 

Now we are going to merge main into our pull request branch for testing, mainly we need to make sure here that master is up to date and start merging:

 

1. use git checkout master to ensure that branch is up to date

2. In my case as you can see it did not work because I had one commit which was not posted to main, in this case you can do resync/update from the VS extension, to get the latest version:

 

Picture7.png

 

3. After master is up to date, we are switching back to TEST

git checkout TEST

 

4. And finally, we can merge master to TEST

git merge master

 

image--007.jpg

 

In the output we can see already the conflict as intended in the git output, but what is more important we have the conflicts and changes in the branch which is ready to be tested directly via Visual Studio, so we can switch now to VS and edit/test/build conflict files 

 

image--008.jpg

 

Version history
Last update:
‎Nov 20 2020 07:26 AM
Updated by: