I have a file that was checked in and is part of a C# project. However, this file is incorrect and it overwrote the previous change which was correct. I need the latest change of this file to revert back to the previous changeset, and I need the previous changeset to be the latest change.
How do I do that?
You can roll back to the previous changeset. This option is only available from the commandline.
tf rollback /toversion:VersionSpec ItemSpec [/recursive] [/lock:none|checkin|checkout] [/version:versionspec] [/keepmergehistory] [/login:username,[password]] [/noprompt]
Alternatively, use Get Specific Version (check all the boxes to override the files) to get the version of the file you want, check the file out and check it back in again. When prompted to resolve merge conflicts, select use local version. This will create a new version on top of the incorrectly checked-in one.
If you install the TFS Power Tool, you can roll back the changeset. With the Power Tool installed, you can do this in the GUI. Select the changeset in a history list, and right click and select Rollback entire changeset.
Here's a nice article:
http://www.edsquared.com/2010/02/02/Rollback+Or+Undo+A+Changeset+In+TFS+2010+Version+Control.aspx
From this article:
You find the TFS Power Tool here: http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f
Related
In the source control explorer it says per file if we have the latest or not, and if you right click and view properties it says the latest version and the workspace version. Is there any way to see the overall latest version and the current workspace version (and possibly to add columns for the two on a per file basis rather than having to check each file's properties one by one)?
We are using both VS2012 and VS2013.
Not from the GUI but you can use the tf properties command to get that with /recursive option
http://msdn.microsoft.com/en-us/library/tzy14b58.aspx
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."
When I get the latest version from TFS, is there a way to list the files that were updated?
if you are using the Visual Studio IDE, you can see the list of files get in the "Output" window.
To see the "Output" window, select menu View-->Output.
Hope this helps!
To your question tf.exe get may help http://msdn.microsoft.com/en-us/library/fx7sdeyf.aspx.
So,
tf get c:\MyWorkspace /all /recursive /noprompt >C:\TFResults\results.txt
Yes.
Open Team Explorer
Select project
Double click Source Control
Optional to get latest: Right click the folder you need and choose Get Latest Version or Get Specific Version and then choose Latest and Overwrite.
Right click the folder you need and choose View History.
You need to take a look into the files on the Output Window. The changeset list, can give you an idea of which are the latest changes files and you can search for those changes.
But a dummy idea is to map your tfs workspace to another folder and download all the files, then user the WinMerge, BeyondCompare or another tool to compare the files in the specific folders you have to get the differences between the latest code, and your current one.
Hope this help
I'm a developer and I've made some changes to a solution, which I have saved off to a shelveset. Another developer unshelves my changes and builds the solution on a server. Is there a way for the second developer to check in my shelveset? I know he/she can check in the individual files comprising the shelveset. However, I was thinking of a "checkin" command that took the name of a shelveset as a parameter, or if there was another way to check in those changes as a unit, with the shelveset name.
The other developer can open a Visual Studio Command Prompt and use the following command:
tf checkin /shelveset:shelvesetname;shelvesetowner
See Checkin Command on MSDN for more details.
I don't think check-in via TFS Command Line directly is a better way, it maybe conflict with the latest code on TFS.
I think the better way to check in shelveset if there are some another changes in you code, but you don't check in it, is create a new WorkSpace in your local computer
Then map the latest code to the new workspace, then unshelve(download) the shelveset, resolve the conflict if necessary, then check in the code
For those having issues with the error:"Items cannot be specified with the /shelveset option.", try putting the user name in parenthesis as follows:
tf checkin /shelveset:shelvesetname;"shelvesetowner"
An easy way to do this is to define a new workspace and have the developer unshelve to that workspace. Then, all of the pending changes for that workspace correspond to the shelfset, and they can check in everything in the workspace.
The second developer can go to Team Explorer -> Builds and right click on the Build definition you are working with.
Select “Queue New Build…”
In the combobox “What do you want to build?”, select “Latest sources with shelveset”.
If you go to the button “…” you can select any shelveset from anyone.
Then check the box “Check in changes after successful build”.
A build runs with that shelveset, the shelveset is checked in when the build passes.
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.