Folder converted to branch?

2019-03-14 09:58发布

In TFS (We are using 2012) why is the default to convert your source folder to a branch? Option

I really don't consider the source a branch. What, if any, advantages/disadvantages does this have?

2条回答
仙女界的扛把子
2楼-- · 2019-03-14 10:37

Just clarifying some terminology in James Reed's answer.

re: "I don't consider the source a branch"

In a biological tree, the Trunk is not called a Branch.

In computer terminology, both sides of a branching relationship are called Branches. It is only the visualization that chooses to show the original branch as a trunk like on a biological tree. (Because the Visualization tools are written by and for us humans who prefer to think of the [1st original] source branch as the Trunk of a biological tree, and the target branch as the Branch off of the Trunk.)

In TFS 2008 terminology, a Branch is a Folder that has a branching relationship to another Folder. Internally they are both folder objects.

In TFS (since 2010) terminology, a Branch is an internal branch object that is [very much like] a folder object with lots of extra metadata (and a different icon).

re: why is the default to convert your source folder to a branch?

In almost all normal circumstances, when you want to branch the Trunk, you want the source Folder [object] converted to be a Branch [object] so that you have all that extra metadata, which allows the extra Visualizations and Manipulations that are not available with a mere Folder [object].

A restriction is that a Branch [object] may not contain another Branch [object], but a Branch [object] can contain a Folder [object]. So sometimes, in a complex project, you may need to convert a Branch [object] back into a Folder [object] so you can put it inside a higher Branch [object].

To do that, use the menu command File / Source Control / Branching and Merging / Convert to Folder. (: It is not on the right-click Context menu because it is needed so rarely. :)

If in managing your total project, you find you need/want to convert a Folder to a Branch (without yet creating a branching relationship by using the normal Branch command), use the menu command File / Source Control / Branching and Merging / Convert to Branch.

查看更多
趁早两清
3楼-- · 2019-03-14 10:40

I'm not sure what you mean by "I don't consider the source a branch" the source folder by definition becomes a branch as soon as you create a branch from it. The target folder is also a branch which is a child of the source branch.

There are no disadvantages to enabling this. Regardless of whether you have this enabled or not the Source and Target will have a branching relationship and you will be able to merge changes between the 2 branches.

If you have this box enabled, as well as being able to merge between source and target you will also be able to use the branch visualisation tools in Visual Studio. These tools are usefull when you want to understand how your code will flow between branches and the merge relationships.

查看更多
登录 后发表回答