Update your branch with the latest changes from master
When working in a branch, you may want to incorporate the latest changes from the master branch into your branch. There are two approaches you can use: rebase or merge.
- Rebase takes the changes made in the commits in your current branch and replays them on the history of another branch. Rebasing rewrites the commit history of your current branch. The history starts from the most recent commit in the target branch of the rebase.
- Merge merges the changes from the source branch to the target branch using a merge commit, which becomes part of the commit history.
merge
To merge the latest changes from the master branch to your branch:
1.In Team Explorer, select the Home button and choose Branches.
2.Check out your target branch. Right-click the target branch, and choose Merge From.
3.Specify a Merge from branch, which is master
in this example, and then select Merge.
If there are any merge conflicts, Team Explorer tells you now. Resolve the merge commits before the next step.
4.Enter a commit message and select Commit Staged.
5.When you're ready to push your local commits, including your new merge commit, to the remote server, choose Push from the Synchronization view.
Rebase
In Team Explorer, go to the Branches view. Click Rebase. You'll see a prompt to rebase the changes from your current branch, and then a drop-down to specify which branch the changes in the current branch should be replayed on top of. If there is a conflict, resolve it just like you resolve merge conflicts in Visual Studio.