官术网_书友最值得收藏!

Reparenting a branch in TFVC

Team Foundation Version Control provides you with an option to prune a branch from somewhere in a given hierarchy and graft it on elsewhere in the same hierarchy. Consider using this approach if the branch structure you put in place is incorrectly set up or has stopped working as you have scaled up. In this recipe, you'll learn how to reparent a branch in TFVC.

Note

The movement of the reparented branch is logical not physical and can be done without stopping developers from working. However, it's a good idea to get developers to shelve changes. You should also endeavor to make the new parent as close in content to the old parent to avoid merge conflicts.

Getting ready

In order to reparent a branch, your user account needs to have the Manage branch permission. The project administrator group and project collection administrator group already grant this permission; however, this permission can be set to allow directly on individual users and groups:

The Manage branch permission allows you to perform the following:

  • Convert a folder into a branch
  • Execute the following actions
    • Edit the branch properties
    • Reparent the branch
    • Convert the branch into a folder

In your TFVC project, create a branching structure as illustrated in the figure on the left:

The scenario we'll be working through in this recipe, as illustrated in the figure on the left, is the Development Team releases from the Main branch; Release 1.1 was branched from Release 1. As illustrated in the figure on the right, the Team wants to move Release 1.1 directly under the Main branch, so changes don't need to go through Release 1 to be merged to Release 1.1.

To reparent the branch Release 1.1 from Release 1 to Main, a relationship needs to be established between the two branches. This can only be done by performing a baseless merge between the two branches. Refer to the Performing a baseless merge between sibling branches in TFVC recipe to learn how to perform a baseless merge.

This recipe assumes that a merge relationship has been established between the Main and Release 1.1 branch. In the preceding figure, the dashed line represents a relationship between the two branches.

How to do it…

  1. Navigate to Source Control Explorer, right-click on the branch Release 1.1 and choose Reparent... from the Branching and Merging submenu:
  2. In the Reparent window, you'll see a list of all branches that have a direct or indirect relationship with Release 1.1. Select Main and click on Reparent. Selecting No parent will make Release 1.1 an independent branch:
  3. The reparent operation takes place on the server. You will not see any pending changes as a result of the reparent operation. The branch hierarchy after the reparent operation is as follows:

How it works…

Once the reparent operation has been completed, you can view the updated branch hierarchy by right-clicking on the Release1.1 branch and choosing Properties from under the Advanced submenu:

Click on the Relationships tab from the left menu to see the branch relationships.

主站蜘蛛池模板: 宣汉县| 柘城县| 遵义县| 建湖县| 祁阳县| 涟源市| 阿巴嘎旗| 台北县| 富顺县| 监利县| 新巴尔虎右旗| 五莲县| 马边| 七台河市| 德化县| 绍兴市| 苏尼特左旗| 焦作市| 油尖旺区| 鄱阳县| 孟村| 平南县| 来凤县| 武鸣县| 武胜县| 温泉县| 鹰潭市| 鲜城| 临江市| 南丰县| 莆田市| 宁德市| 南昌市| 浮山县| 利津县| 江陵县| 南皮县| 甘肃省| 墨玉县| 会昌县| 秀山|