Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branching vs. Shelves in TFS

Tags:

I've always used SVN in my past, and now that we have moved past the initial phase of a project we need to figure out our branching process for future enhancements.

In reading up on this, we see that TFS has Shelving.

How do they compare? What are the big gotcha's on each?

In general, which is preferred and why?

like image 796
Clarence Klopfstein Avatar asked Jan 13 '10 21:01

Clarence Klopfstein


People also ask

What is Branching in TFS?

Branching in TFVC uses path-based branches that create a folder structure. When you create a branch, you define a source, usually the main folder, and a target. Then files from the main folder are copied into your branch.

What is shelve in TFS?

The shelve command of the tf command-line utility backs up pending changes, a list of associated work items, in-progress check-in notes, and comments in a shelveset on the Team Foundation Server. A *shelveset *is much like a changeset that is not committed to the server.

What is shelve and Unshelve in TFS?

Unshelving is how you restore the shelveset to your machine so you can keep working on it. It doesn't change the shelveset on the server (to do that you need to shelve things again and use the same shelveset name).

How do you get shelve in TFS?

To shelve your current pending changes, right click the project, Shelve, add a shelve name. This will save (or Shelve) the changes to the server (no-one will see them) You then do Undo Pending Changes to revert your code back to the last check-in point.


2 Answers

Shelvesets are per-user and differently stored in the source control - it is not possible to merge shelvesets, there's no history etc. The only action possible is unshelving; you cannot even merge files while doing so. So, we only use it as a temporary storage for things that are not finished yet and thus cannot be checked into a branch.

So, you should use branches ;-) maybe a Main branch and different development branches for features & bugfixing.

like image 94
fwalch Avatar answered Sep 20 '22 16:09

fwalch


Shelving and branching are not the same concept.

Branching is taking a code base and "splitting" it off, basically making a copy of it. Development teams can all work on their own branches (for example) and then all changes can then be merged back into an originating branch. Branches can only be merged into a parent branch in TFS.

Shelving allows developers to check code into the source control system into a "shelve". The code is not checked into the main branch. If a build manager or another developer "gets latest", he will not get shelved code by default. The shelve is safely stored in source control like all other code, it is just not in the branch. Other developers can pull shelves down to see the effects. At some point, the changes will be checked into the main branch and will be part of a changeset.

I suggest this book: http://www.amazon.com/Team-Foundation-Server-2008-Action/dp/1933988592/ref=sr_1_1?ie=UTF8&s=books&qid=1263417920&sr=8-1

It has a very simple, yet effective explanation of shelving, merging and various branching models.

like image 24
Jeremy Samuel Avatar answered Sep 16 '22 16:09

Jeremy Samuel