In VS,
- open the git pane.
- View the branches sub-pane.
- Expand the'origin' branch
- right click the master branch (under origin)
- select merge master branch in origin\branch 2
- under local branches right branch 2 pull latest
- done
In VS,
- open the git pane.
- View the branches sub-pane.
- Expand the'origin' branch
- right click the master branch (under origin)
- select merge master branch in origin\branch 2
- under local branches right branch 2 pull latest
- done
This is old, but this is how to do it for anyone new showing up here.
From the branch you want the master merged into, open the Git Changes panel and click the branch dropdown. Right-click on the master branch to open a sub-dropdown. Choose "Merge into current branch."
You may need to fix files as you go along, so be prepared. In most cases, if the branches are closely related, the merge will happen without user input.

@Albertk
The workaround I've found is to use Git outside of VS. I agree this is a pain, but MS seem to have a very one-dimensional view of how you should use Git.
I installed Git-Bash some time ago and the commands
git checkout master
git merge version2
should work on your local repository.
You probably should close down VS (or at least the project) before doing this - I've not tried with VS open in case it breaks something.
With GIT you need to create a Pull Request to merge your code into another branch in the remote repository
https://devblogs.microsoft.com/devops/conduct-a-git-pull-request-on-visual-studio-online/#:~:text=Open%20the%20web%20portal.%20In%20your%20web%20browser%2C,Reviewers%20make%20comments%20on%20specific%20lines%20of%20code.
Locally in the Git changes window make the active branch the branch you want to merge into. At top of the window is a drop down list a list of branches hit the arrow at the right hand side of the branch you want to merge from. In the list that shows select merge into current branch
git - Visual Studio 2015 How to merge a branch into master? - Stack Overflow
Merge a Feature Branch into main
Git: How to merge feature branch into master using VS Code source control? - Stack Overflow
git - Merge candidate branch in origin/master to master in Visual Studio - Stack Overflow
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:

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

Without asking about the strategy you're following in your team.. I wonder why the option merge origin/candidate into master is disabled! You could
- Restart Visual Studio and wait untill no background processes are there.
- Right click on local master -> fetch and wait.
- Right click on Remote candidate -> merge origin/candidate into master -> Ok.
Note: keep an eye on output window in visual studio -> select 'Source Control - Git' to see git commands output.
Checkout master (according to your screenshot you already have). Then pull origin/candidate into master.
I guess usually you would wait for the remote master to merge candidate and then pull origin/master into master and for the time being you would checkout origin/candidate so your local branch names match the remote branch names. At least that would cause less confusion for me.
Check out the attached link from Microsoft
https://blogs.msdn.microsoft.com/kenakamu/2017/10/01/git-and-visual-studio-2017-part-5/
Take a look at the Merge in VS section. Hopefully this should provide enough of a guide for you to perform the requested action.
Here's a quick snippet from the page that specifically shows the steps on merging branches. You'll need to just change the branches that are being referenced to the ones that you're using -
Go to Team Explorer and select Branches. Checkout master and click “Merge”. Same as Git command, you need to be on master to merge dev branch.
Select dev on “Merge from branch” menu and click Merge. Note that I keep “Commit changes after merging” checkbox on.
Off the top of my head, open the Team Explorer view. At the top there's a drop down where you can click 'Branches'. After clicking that you will see your master and gh-pages branch. Make sure you're on the branch you want to merge into i.e. 'gh-pages' and then right click the 'master' branch. A context menu will appear with 'merge from' option. Click that and then click 'merge'. That's one way to merge, the branching strategy you should use is a different question altogether.
Sorry if this is the wrong place, I realise this is Git via the Visual Studio interface but I guess the underlying process is the same?
We have a platform running on Azure and use DevOps for source control. I have a local repo, cloned from DevOps, running in Visual Studio 2019. I synced this to master about a week ago and have since been making changes in a branch I created.
Apologies for the stupid question, I'm brand new to this! I am terrified of committing and pushing my changes and overwriting the rest of the work devs have been doing. Do I need to sync the master branch first? Will it only push my changes and leave the rest of the source code as is on DevOps? What is the correct procedure to upload my branch to the test environment and not overwrite anyone else's work, please?
Thank you!









