- Microsoft Team Foundation Server 2015 Cookbook
- Tarun Arora
- 723字
- 2021-07-16 09:41:17
Performing a baseless merge between sibling branches in TFVC
Managing source code can get challenging when multiple Teams are contributing to the same repository. Are you already familiar with the branching and merging tools available in TFS? If not, I would encourage you to go through the ALM Rangers Version Control Guidance http://bit.ly/1He8pmL. The guidance talks in detail about the various branching strategy and its pros and cons.

An extract from the ALM Rangers Version Control Guide showing different branching strategies
Branching in TFVC can get complicated over time; branching in Git is lightweight and path independent. In Git, many developers create a branch for each new feature they are coding, sometimes on a daily basis. Git allows you to quickly switch from one branch to another to pivot among different variations of your codebase. When using Git, you can create branches that exist only on your Dev machine and share them if and when you're ready. Consider evaluating your source control requirements against the workflow at http://bit.ly/1P7UMvO; you may find Git a better fit.
In this recipe, you will learn how to carry out a merge operation between two unrelated TFVC branches often referred to as sibling branches.
Getting ready
In your TFVC-based Team Project, create a branching structure as illustrated in the following diagram. You can use the TFS Community Branch Tool extension to automate the creation of the branch, as illustrated in the following diagram (http://bit.ly/1LZR2bx):

We'll be working through the following scenario in this recipe. The developer working on Dev branch has found a critical issue that he has resolved with a code check-in. The QA branch is already being used by another developer to carry out some unrelated work. To get the fix from Dev branch into production, the developer decides to perform a baseless merge between the Dev and Prod branch.
In order to perform a merge operation, your user account needs to have the merge permission. The project administrator group already grants this permission; however, this permission can be set to Allow directly on individual users and groups:

How to do it…
- In Visual Studio, open Team Explorer, and navigate to the Source Control Explore. Perform a Get Latest Version operation on the FabrikamTFVC Team Project:
- To simulate a fix being made in the Dev branch, open the
$\Dev\FabrikamFiber.CallCenter\FabrikamFiber.Web\Controllers\HomeController.cs
file and copy the following comment in theIndex
method:Check in the code changes to this file from the pending changes view in Team Explorer:
- Now that the critical change is in the Dev branch, let's look at the steps required to carry out the baseless merge of this change from the Dev branch to the Prod branch. From the source control explorer, right-click on the Dev branch and choose Merge... from under the Branching and Merging submenu:
- The Merge wizard will not show the Prod branch in the Target branch dropdown. Unrelated branches can only be selected using the Browse... button. Click on Browse... and select Prod branch. Then, click on OK:
- A warning sign shows up next to Target branch indicating that the chosen branch is unrelated and will cause a baseless merge:
- Click on Next to navigate to the next screen:
Note
If the selection is changed from All changes to Selected changesets then a merge relationship between the two branches has not been established. While you would still be able to merge the change, you won't be able to visualize it.
- Keep the Latest Version selected in the dropdown and click on Next:
- Once the merge operation has completed, you'll be navigated to the Resolve Conflicts window. Click on Merge Changes In Merge Tool, then check and click on Accept Merge:
- The Resolve Conflicts window will clear of any conflicts once the merge has completed. From the pending changes viewed in Team Explorer, check in the pending changes:
- From the Source Control Explorer, right-click on the Prod branch and choose View History. Check all the branches and click on Visualize. The dashed line from Dev to Prod represents the baseless merge.
How it works…
When a baseless merge is carried out, a relationship is established between the two sibling branches. The baseless merge is represented by the dashed line:

To get a view of the timeline of the change, hit the Timeline Tracking view at the top of the screen:

- Mastering Concurrency Programming with Java 8
- Learning RxJava
- SQL語言從入門到精通
- C#程序設(shè)計教程
- Learning Unity 2D Game Development by Example
- QPanda量子計算編程
- Google Maps JavaScript API Cookbook
- HTML5+CSS3+jQuery Mobile+Bootstrap開發(fā)APP從入門到精通(視頻教學(xué)版)
- 軟技能2:軟件開發(fā)者職業(yè)生涯指南
- C語言程序設(shè)計
- Expert Cube Development with SSAS Multidimensional Models
- 深度學(xué)習(xí)的數(shù)學(xué):使用Python語言
- Access 2010數(shù)據(jù)庫教程(微課版)
- 編程真好玩:從零開始學(xué)網(wǎng)頁設(shè)計及3D編程
- Python輕松學(xué):爬蟲、游戲與架站