Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 How to merge a branch into master?

People also ask

Can you merge a branch of a branch to master?

Once the feature is complete, the branch can be merged back into the main code branch. First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch.

How do I merge a branch into main?

To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.


The way to merge development_print branch into master branch as below:

VS -> Team Explorer -> Branches -> double click master branch -> Merge -> select development_print for Merge from branch -> Merge.

The select box shows:

development_print
master
origin/development_print
origin/master

That means you have branches development_print and master for both local and remote. origin/ means branches exist in remote.

If you don’t want the development_print branch after merging you can delete it for local and remote:

Team Explorer -> Branches -> select development_print -> right click -> Delete -> select development_print under remotes/origin -> Delete Branch From Remote.


You can follow the Microsoft tutorial "Create work in branches".
Also, as shown in "Getting Used to Git in Visual Studio: Branches" from Jeremy Bytes (2014, but should still apply), you can go back to the "Branches" section and select "Merge".

This gives us drop-downs to fill in:

https://4.bp.blogspot.com/-m3zHy1wthZA/VKIadAAXBqI/AAAAAAAADqY/0LczBDT-kOE/s1600/Merge.png

You can see the branch section in "Microsoft Application Lifecycle Management", also used when you created your topic branch:

https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/45/92/2014/06/pull_2D00_requests/6242.VCtrlGitPullReqCreateTopicBranch.png


In VS switch to master branch to be your current branch and from Team Explorer -> Branches you should get the Merge options in the right order where you will be able to select in the "Merge from branch" drop-down development_print branch and the "Into current branch" field will be preselected with master.