Taking my project to its previous state - tfs

I've a project added to my Team Foundation Server 2010 installation and I've done some code check-ins.
I need to restore the project to the point it was in the last check in, but, when I try to get the lastest version or a specific version, one of the files (File1.cs) I've modified is not checked out.
I realized that File1.cs was not checked-in the last time but I wanna roll back the project to the point it was in the last check-in.
What really does "Get lastest version" and "Get specific version"?
I'm very confused about these two options.

Get specific will get file at the given changeset. But if that file wasn't changed between the changeset you're at and the changeset you're getting, then this is a no-op.
The easiest way to find the version of the file you want to get is through View History. Find the changeset you want to get, and select "Get This Version". This will get only the file in question at that version.

Related

TFS: "Get This Version" vs "Rollback Entire Changeset"

I find myself needing to remote debug some deployed code, I have a clear changeset defined in tfs that is the code that was deployed.
My question is: What is the standard procedure in TFS to ensure my local code matches what has been deployed to live.
"Get This Version": I seem to recall that operation only checks out the changeset in question, leaving all other files in place, some of which have have been changed by another later changeset
"Rollback Entire Changeset": This one appears most promising, but I'm confused if it means 'Roll back TO this changeset', or if it means 'Roll back this changeset' effectively leaving the code in a state BEFORE that changeset was checked it.
Any clarification would be greatly appreciated.
According to your description, you shouldn't use rollback entire changeset feature. This will influence your source control in TFS. If you roll back a file to an earlier version, tfs will eliminating the effect of all changesets that occurred after that version. More details please take a look at this tutorial: Roll back changesets
Actually you just want to get an older version in history include all files for a branch or root project folder.
In TFS, you could Get Specific Version instead of get latest version of the branch. Details please refer this question: TFS Get Specific Version into separate folder
How to do this in VS: right click the branch-Advance-Get Specific Version. Have a look at my answer in this similar question: TFS source code explorer: browse specific revision

Visual Studio Team Services Monitor User

So far I was working my my project myself using Visual Studio Team Services using VS 2012, everything was good. Now I have added another user for my project and things are NOT working as I expected, below are my basic questions.
After my developer is done adding/editing files, does he needs to tell me the ChangeSet # to refer to? so I can get his Check-in's?
How Can I see What files he modified/Added? And is there a way I can get only the changes I want from the user instead of getting his/her entire changeset/files?
"Get Latest Version" does not really gets me the Latest Version of files which my developer modified.
See below answers:
After my developer is done adding/editing files, does he needs to tell me the ChangeSet # to refer to? so I can get his Check-in's?
--> He doesn't need to give you Changeset# to get latest(his check-ins). You can go to Team Explorer --> Source Control Explorer and then right click on your project and select "View History" to look at all the changes done to the project. Do you see his changes in the history? If yes then "Get Latest Version" should work. Sometimes what happens if you try to get latest version in Visual Studio Solution and if the files changed are not part of solution you won't get those files. In those cases you need to get latest from Source Control Explorer.
How Can I see What files he modified/Added? And is there a way I can get only the changes I want from the user instead of getting his/her entire changeset/files?
--> If you double click on the changeset after following the above steps to go to View History you will see all the files changed. If you want to get only few files from a check-in you will have to get the latest at file/folder level instead of getting it at project level. i.e. Find out all the files changed using above method and then go to individual files/folders in the Source Control Explorer to get latest.

check out TFS at a specific change set

I'm using TFS and VS 2012 and my project is in a broken state and I can't figure out why. I'd like to go back to a previous version of my solution when I know it worked and make changes on that working version. However, when I choose to check out a specific changeset, it seems to me like it's only changing the files that were changed in that changeset. When I use git and check out a revision, my code looks exactly like it did at that revision. Files that didn't yet exist at that revision are removed, files that did exist have contents as they were at that revision, etc. But I can't seem to do the same in TFS. I can't figure out how to get all of the files (and only the files) in the state that they existed when a particular changeset was checked in. Am I missing something? Any help REALLY appreciated.
Try using the Advanced option when you right click on a solution or folder in Source Control:
Then when the dialog appears, check both check boxes so the version you have is overwritten with the specific version you want by selecting Changeset from the ddl and entering the changeset you are after...
This should overwrite the existing solution files with the specific version.
If you have trouble doing it over top of existing files, delete the source on your local machine first and get the specific version after that.
A changeset is just the files checked in at one time, not a snapshot of the whole system. You want to use labels for that. A label will mark all the files in their present state, just as you describe Git doing.
Find the changeset you want and "Get This Version" to only get the changed files.
Manually check out each file for edit in Source Control Explorer to match the changeset.
Now the previous changeset's edits can be checked in.
NOTE: This is MUCH quicker than getting the entire repo using "Get Specific Version."

Getting a specific complete build from TFS

There is one particular change I am testing. This is ChangeSet: 123456 (let us assume). I need to get the complete solution as on the data that changeset was checked in.
If I do Get Specific Version -> By ChangeSet: 123456, I get only those files that were affected by the change set. I am unable to get the entire project.
Please help.
If you go to the source control explorer, you can select the root folder of the project and do a "Get specific version". It will do a get of all the files that are not locally of the correct version yet.
You can force to get all the files by clicking the other option to get all the files in that dialog.

How to get a previous version of a file

I need to get a previous version of a file in source control, using Team Foundation Server (TFS), . When I try to get a specific version based on change set the merge screen comes up. I do not want this, I just want to get the previous version and have it checked out. My current version of the file got corrupted and now I just want the previous version.
Ah, it sounds like you want to rollback (that is, remove some checkins from TFS' history). There is not a built-in way to do this with TFS. However, you can use the TFS Power Tools to accomplish this (there is a tfpt rollback command).
In practice, the rollback command just does what you're trying to do. To do it manually, get the version that you want (without checking out the file). Save that somewhere else, then check the file out (which will perform a "get latest" command). Then overwrite that version with the version that you saved elsewhere.
Alternatively, there's a setting in the TFS settings to "Get latest version of item on check out," which may be the cause of all of your problems. It's located in Tools->Options, under Source Control->Visual Studio Team Foundation Server. If that's checked for you, try unchecking it and seeing if it'll let you do what you're trying.
On the merge screen, you should be able to choose to overwrite your local copy with the server version. That sounds like what you want to do.
However, the merge screen should only show up if you have pending changes. If you undo your pending changes on the file, the Get Specific Version command shouldn't cause a merge.
Hmm maybe I am doing something else wrong. I check the file out, then I do get specific version, enter the changeset number, I do not check either of the overwrite check boxes. I get the merge screen, I tell it to overwrite local copy. It does this, but then it undoes my check out and says I do not have the latest on my local computer. If I checkout at this point it ovewrites my previous version with the latest.

Resources