I'd like to rollback a change I made recently in TFS. In Subversion, this was pretty straightforward. However, it seems to be an incredible headache in TFS:
Option 1: Get Prior Version
- Manually get prior version of each file
- Check out for edit
- Fail - the checkout (in VS2008) forces me to get the latest version
Option 2: Get TFS Power Tools
- Download Team Foundation Power Tools
- Issue rollback command from cmd line
- Fail - it won't work if there are any other pending changes
Option 3: Manually Undo Changes
- manually undo my changes, then commit a new changeset
Question
How do I rollback to a previous changeset in TFS?
The big disadvantage of the tool is that it will want to refresh everything in your workspace before you can merge. I got around this issue by creating a new workspace just for the rollback which mapped directly to the place in the source tree where the affected files were.
If you need help to figure out which changesets to roll back, I find the code review tool in the free Team Foundation Side Kicks add-in very helpful.
For reference, if you're using TFS 2010, here's the link to Rollback Command (Team Foundation Version Control) manual.
To rollback a particular changeset, go to Visual Studio Command Prompt (2010), navigate to your TFS workspace directory, and type in command:
where
12345
is your changeset number. After this, it will show you the log of what it did and you'll have to sort out merge conflicts.Ben Scheirman - the Changeset Details dialog does not have rollback functionality.
You have two options for rolling back (reverting) a changeset in TFS 2010 Version Control. First option is using the User Interface (if you have the latest version of the TFS 2010 Power Tools installed).
The other option is using the TFS 2010 version control command-line application:
I have information about both approaches on my blog post available here: http://www.edsquared.com/2010/02/02/Rollback+Or+Undo+A+Changeset+In+TFS+2010+Version+Control.aspx
Another way to make your option 1 work is to reverse the order of the steps:
This will work even if you have Get Latest On Checkout set.