Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a TFS branch a physical or logical snapshot?

Tags:

branch

tfs

When code is branched in TFS using the branch method, is the code physically or logically branched? By logical, I mean is it just a changeset (changed deltas) or are all of the files copied?

like image 730
Jordan Parmer Avatar asked Feb 11 '09 15:02

Jordan Parmer


People also ask

What is branching in Visual Studio?

It's easy to create a new branch in Visual Studio; all you have to do is base it off an existing branch. Here's how. To start, make sure you've got a previously created or cloned repo open. From the Git menu, select New Branch. In the Create a new branch dialog box, enter a branch name.

How do I create a main branch in TFS?

In Source Control Explorer, right-click the folder or file that you want to branch, point to Branching and Merging, and then click Branch. The Branch dialog box appears. In the Target box, modify the location and name for the new branch. You can also click Browse to specify a target.


2 Answers

Branched files are not copied within the TFS database. A new version of the file will not be created until the branched version is modified. This is why creating a branch on a large project does not take forever.

Source:

http://www.codeplex.com/BranchingGuidance/Wiki/View.aspx?title=Isolation%20for%20Collaboration&referringTitle=Home

The fourth paragraph under branching explains that it does not create a separate copy of identical files:

Creating branches uses very little additional storage space. The server minimizes the storage required by only keeping one copy of identical content no matter how many different files are contained in the folder. So, if you have 100 copies of a 1 MB file and all of the files are identical, the server will store only 1 MB, not 100 MB. When you create a new branch and commit, all of the files in the new branch that are identical to the files in the source branch point to the same content. The result is that a branch consumes very little additional storage space, and that storage space expands only when the branched file becomes different than the source. And even when files change, Team Foundation Server employs a differencing engine to analyze changes between files and once again optimize storage space.

Microsoft Branching Guidance PDF:

http://geeks.netindonesia.net/downloads/etc/TFS-Branching.pdf

like image 87
Jim Petkus Avatar answered Dec 02 '22 17:12

Jim Petkus


Short answer: Branches are stored logically and are not a direct copy of the parent.

Long answer: Bill Heys, a VS ALM Ranger, wrote a detailed blog post describing how branches and file history are stored in TFS.

http://blogs.msdn.com/b/billheys/archive/2011/05/05/how-tfs-stores-files-and-calculated-deltas-on-versioned-files.aspx

like image 45
James Wulkan Avatar answered Dec 02 '22 16:12

James Wulkan