Wesley Brandt
Wesley Brandt

Reputation: 355

How do I merge current master branch into my branch visual studio/azure devops?

So I have the master branch, and another branch, lets call it 'branch2', that I am working on that is based off of the master branch. There are important changes in the current master branch that were made from someone else that I need to merge into branch2. Just wondering how to do this within visual studio or azure devops.

Upvotes: 11

Views: 53839

Answers (4)

Bárbara Malafaia
Bárbara Malafaia

Reputation: 11

  • Open your Azure DevOps
  • Access the Pull request
  • Select New pull request
  • Select MAIN into
  • Create > Approve > Complete

Upvotes: 0

mediaXpert
mediaXpert

Reputation: 101

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.

enter image description here

Upvotes: 9

Tom McDonald
Tom McDonald

Reputation: 1892

In VS,

  1. open the git pane.
  2. View the branches sub-pane.
  3. Expand the'origin' branch
  4. right click the master branch (under origin)
  5. select merge master branch in origin\branch 2
  6. under local branches right branch 2 pull latest
  7. done

Upvotes: 17

Rick Tilley
Rick Tilley

Reputation: 172

Download gitbash for windows, or install git on linux. I recommend command line rather than trying to use the VS or DevOps GUI. I prefer command line simply because I have better control over my commands and are less likely to mess things up. When things do get messed up, I can review the commands I used that led me there. Be sure to be in the root folder of your git repo when you use the commands. These are the three commands you would use:

git checkout branch2
git fetch
git pull origin master

What this is doing, you want to be in your feature branch, "Branch 2". Then you do a fetch, which pulls changes down from the server but doesn't apply them. Then when you pull origin master, you are pulling the master branch changes into your current branch.

Upvotes: 2

Related Questions