I have done some work on my code and shelved it, then I had to apply a patch to the code from a shelveset to get things working properly. I then had to fix something else in the code and now wish to make a shelveset, but without the patch, so I want to undo the shelveset that I applied.
Is this possible and if so, how?
Given the state you're currently in: No.
If the original shelveset still exists you could "undo pending changes" then reapply the original shelveset.
There is no local history available to you.
Related
good morning, people!
A co-worker has made some changes to the project and now it is necessary to do the same so that I do my part now. However, he can not give a check-in because another team member "pulls" the latest version, it will pick up that part that no case could not, only I could remove those changes and after I do as the changes, yes do the standard check in.
This refeel a my doubt, should be something simple. And neither is it done the same for this not TFS. It's possible?
Your title is talking about how to share shelve with other TFS Members. There is a concert called Shelvesets in TFS. Shelvesets are useful when you want to stop work for:
Collaboration: You have pending changes that are not ready for check
in but you need to share them with another team member.
Other peoples could share their pending changes(haven't checked in) to you through shelveset. You could unshelve his shelveset which restores shelved file revisions, check-in notes, comments, and work item associations to the current workspace.
If you don't want the shelveset mess up your local work in VS, please also take a look at my reply here: Undo TFS Unshelve
I have little question, we have an project and I have made some changes in one file and I need to undo those changes ( I have not checked them ) and I need to get the latest version. If I will go for "Undo pending changes" it will only change my files and will not change TFS files right ?
Yup. Changes are only local until you commit them in tfs.
I rolled back a changeset. Now I need to check out the changeset that was rolled back with 'actualized' pending changes. So like everything is before the commit of the changes.
When I get specific version with files override I see nothing in pending changes window.
How can I get the state I need? Is it possible?
After doing the "Get Specific version" you need to check out every file in the changeset manually (right-click, check-out). Be sure that you have the "Get latest on checkout" turned off.
After that perform a get latest, which will prompt you to merge. This is going to be a more tricky merge, since Visual Studio will assume that the newer version is what you want. When you're satisfied, check in the code.
Alternatively start with the same steps as the first solution, but instead of immediately doing a get-latest, you can create a shelfset after you've checked out each file and then perform a get latest. When you're on the target version, unshelf your changes, resolve any conflicts and check them back in.
Another trick you could apply is to find the changeset number that contains the rolled back changes. Since this checkin is a compensating checkin, you might also be able to re-do the changes by rolling back that compensating changeset. I tried this in a local workspace and it works. Again you might need to go through a merge and it's hard to tell exactly which changes to pick.
My best advice on this is: try not to get into this situation :).
I accidentally rolled back an entire changeset. How can I undo that operation, and restore the changeset?
If you select "Rollback Entire Changeset" in TFS, it changes the local files so that the changes made in the changeset are reversed.
Since this is a local change and does not take effect until you check the changes in, you can "undo" the rollback by using "Undo pending changes" on your project. Note this will also mean any other uncommitted changes would also be lost, so use with care.
You can always "View History" and retrieve a particular Changeset...
Get the Latest version and Rollback the earlier roll-backed change set and now they get checked out and now check in the changes after required modifications.
Alternatively you can use the following command in visual studio command window:
tf rollback /changeset:changeset_number
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?
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.
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.
I use shelve to back up code-in-progress, just on the off chance my hard drive crashes or whatnot. I don't even have to worry about the code building, never mind working, since the work won't be seen by any other developers on my team (unless they go looking for it).
Unshelve pends the changes back in your workspace. Removing the shelveset from the server is a Delete.
Following on to what Richard Berg said, the power tools' version of unshelve actually includes a get and resolve.