Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I rollback a TFS check-in?

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

  1. Manually get prior version of each file
  2. Check out for edit
  3. Fail - the checkout (in VS2008) forces me to get the latest version

Option 2: Get TFS Power Tools

  1. Download Team Foundation Power Tools
  2. Issue rollback command from cmd line
  3. Fail - it won't work if there are any other pending changes

Option 3: Manually Undo Changes

  1. manually undo my changes, then commit a new changeset

Question

How do I rollback to a previous changeset in TFS?

like image 654
Jason Avatar asked Aug 28 '08 15:08

Jason


People also ask

How do you undo a checkin in TFS?

In the local toolbar of the File List, click , then select Undo Check Out (for selected files) or Project > Undo Check Out All (for all files in the project).

How do I revert to a previous version of TFS?

To roll back to a specific versionIn Source Control Explorer, select an item, open its shortcut menu, and choose Rollback. In the Rollback dialog box, select Rollback to a specific version.

How do you change checkin in TFS?

In the team explorer open up the source control tab, then right click on the route folder and select Check in Pending Changes. This will check in all the files over all the solutions/projects that you have underneath the root. Repeat the process for any other team collections you have used.


2 Answers

  1. Download and install Team Foundation Power Tools.
  2. Open up the Visual Studio command prompt
  3. Navigate to the directory on the file system that TFS is mapped to. If you don't do this you'll get an "Unable to determine the workspace" error when you try to roll back
  4. Make sure everything else is checked in or shelved
  5. run tfpt rollback to bring up the interface.
  6. Choose the changesets you want to rollback
  7. Check in the new versions of the files you rolled back

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.

like image 130
Helephant Avatar answered Oct 08 '22 02:10

Helephant


Your solution #1 will work: 1. manually get prior version of each file

  1. check out for edit

  2. Checkin the file and Ignore server changes when prompted.

The reason why it failed for you is because you must have the "Get latest version of item on check out" option turned on. Turn this option off by going to Tools...Options...Source Control...Visual Studio Tema Foundation Server and unchecking "Get latest version of item on check out"

Cheers

like image 45
Happer Avatar answered Oct 08 '22 02:10

Happer