This article is contributed. See the original author and article here.

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:


 


Picture1.png


 


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:


 


Picture2.png


 


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


 


Picture3.png


 


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


 


git fetch origin


 


Picture4.png


And checkout it locally


 


Picture5.png


Active branch is now TEST


 


Picture6.png


 


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


 


Picture8.png


 


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 


 


Picture9.png


 

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.

%d bloggers like this: