Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unshelving in TFS: What does it mean?

Here's the part I get: When you shelve in TFS, it makes a server copy of the changes so they are not lost, but does not check them into the source code trunk/branch you are working on.

Question: Under what circumstances would you use the "unshelve" feature? Does it mean it will remove the shelveset from the TFS server? Can you do a get from a shelveset? Or is it really just a diff description between the shelveset and the "real" source code?

like image 522
brentlightsey Avatar asked Feb 24 '10 20:02

brentlightsey


People also ask

What does Unshelve changes mean?

Unshelve changes: Ctrl+Shift+U. Shelving is temporarily storing pending changes you have not committed yet. This is useful, for example, if you need to switch to another task, and you want to set your changes aside to work on them later. With IntelliJ IDEA, you can shelve both separate files and entire changelists.

How do I Unshelve a file in TFS?

Go to File -> Source Control -> Unshelve Pending Changes….

What is code shelving?

Shelving is a feature that is available through the use of Team Foundation Server (TFS) from Microsoft, a tool for source code management. This feature allows us to create what is known as a “shelveset,” which will essentially hold our local changes in the repository without committing them to the shared codebase.

What does Unshelved mean?

(transitive) To remove from a shelf. (figuratively, transitive) To bring back something that was shelved, or put aside.


2 Answers

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).

One example for how I use it is to move changes between machines while I'm working on them. I'll shelve it on my desktop machine, then unshelve it on the laptop and then continue working on the laptop.

You can also use it to share changes with someone (for code reviews or other reasons). You shelve your changes, then the other person can go and unshelve it to see what you've done.

Unshelving doesn't actually change the shelveset or anything else on the server. It's just a get operation.

like image 186
Herms Avatar answered Dec 13 '22 12:12

Herms


Herms is spot on. Read his answer.

One important caveat: if you've done a Get since the shelveset was created, Unshelve will only rollback the local version of files contained in the shelveset. Thus, it's quite likely you'll have an inconsistent workspace.

A good practice is to always re-run Get after you Unshelve. This ensures you don't waste time on phantom build errors that are actually just side effects of being in a half-new/half-old state. It will also require you to resolve any conflicts between the shelveset contents and the latest server revisions proactively, instead of only discovering them @ Checkin time.

like image 30
Richard Berg Avatar answered Dec 13 '22 12:12

Richard Berg