If you have been following along you will know that I’ve now transitioned all code repositories to BitBucket and using Visual Studio 2017 for code development. In my last post I detailed my plan to create branches, merge them back to the master and start the process all over again. Well, it’s time to do my first merge so what does it all look like.
As we can see in our commits view, we can see the two different branches being actively being developed against: PhoneProvisioning and BugFixes04.
|Step #1: Revisit Visual Studio and ensure there are no changes due to be committed. To do this, go to Team Explorer||Changes|
Here we can see there are no changes to be published.
|Step #2: So our next step is going to be to take the BugFixes04 branch and merge it into the Master. To do this, we go to Pull Request||Create New Request.|
I want to close and merge this branch. So it’s critical that you select the “Close Branch” option at the bottom. Now you can click Create Pull Request.
Step #3: Review code and merge. The pull request will show you everything that is being updated in this merge. You can see two files changes and below this (not included in the screen shot) is the actual code differences. You can view it inline or side-by-side to see the changes.
Once everything looks good and you are happy with the code changes you can choose Merge. You will then get this option:
So there are Merge Strategy options. You can read all about them and how they impact your project. I’m going to choose the default for BitBucket which is git merge –no-ff (or no fast forward).
If we go back to the Commits view, we can see the first merge is now complete.
Step #4: We are going to repeat Steps 2 and 3 and merge the PhoneProvisioning branch into the master now. I won’t take screenshots of this part but trust me that they look exactly the same as before.
If we take one more look at Commits after the final merge we will see everything is in the single master branch now.
|Step #5: Now we need to go clean up visual studio. Because its going to think we still have branches left over. So we head to Team Explorer||Branches. We find our Master branch, right-click and choose check out. Then right-click, choose Pull.|
This will pull down everything for the master branch that was merged and updated your local repository.
Here, we can see that it says fetch and pull were complete. Now my local copy of Visual Studio matches exactly what is up in BitBucket. Now it appears you can right-click and choose delete to the BugFix04 and PhoneProvisioning in the local copy (that is the top ones in the images). The bottom ones are still there but the branches don’t exist in BitBucket. There is an option to Delete Branch from Remote but I’m going to hold off on that for now.