Reputation: 355
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
Reputation: 11
Upvotes: 0
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.
Upvotes: 9
Reputation: 1892
In VS,
Upvotes: 17
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