11

I am new to Team Foundation server and someone committed changes that they weren't supposed to the night previous. I need to revert this changeset so that when people get latest version they will not get these changes.

I see no easy way to do this, does anyone have experience with this?

CatDadCode
  • 58,507
  • 61
  • 212
  • 318
  • Which version of TFS are you using? Apparently, some versions are easier than others, according to MSDN. See http://msdn.microsoft.com/en-us/library/dd380776.aspx. – villecoder Apr 21 '11 at 14:43
  • Is there any way using TFS 2008 to do this? – Maggie Apr 21 '11 at 15:34

5 Answers5

6

You can't really rollback a changeset. What you have to do is:

  1. Find the changeset number you want to get back to.
  2. Perform a check-out of all the files that is in need of a rollback.
  3. Perform a get specific version (different from get version) and specify the changeset number and select the options to overwrite your local copy with what's in the changeset.
  4. Perform a check-in which would overwrite what is on the server.

You have to do this separately for every file. There you can look at the TFS Power tools which has a rollback that kinda automates the manual steps listed above.

Good luck!

WhatIsHeDoing
  • 541
  • 1
  • 6
  • 20
tdavisjr
  • 486
  • 2
  • 8
3

I think you are looking for the rollback command: Rollback docs

Paul G
  • 2,722
  • 4
  • 37
  • 54
  • Can you not accomplish this through the visual studio interface at all? – CatDadCode Apr 21 '11 at 16:06
  • I think in TFS 2008 you had to have the TFS Power Tools installed and they move it up to a base TFS command in 2010. There is a similar question here (http://stackoverflow.com/questions/32607/how-do-i-rollback-a-tfs-check-in) with lots of info. – Paul G Apr 21 '11 at 16:27
  • 2
    Please be careful with Rollback (either from the Power Tools in 2008, or command line in 2010). The function is not "rollback to" a changeset. Instead, TFS will do its best to rollback the changes from the changeset, then reintegrate any changes from that changeset forward. It can be ugly if that's not what you were thinking it would do. – Robaticus Apr 21 '11 at 16:41
1

You can do this easily in VS2010 via a nice interface, in a similar way you'd do it with Tortoise SVN, as long as you are also using TFS 2010 on the back-end (make sure this is the case before you try the following, otherwise it won't work):

Get the Team Foundation Server Power Tools December 2011

(You may need to restart your computer after the install)

Then in VS2010 go to View > Other Windows > Source Control Explorer

right-click the project from the Source Control Explorer window and select 'Rollback' - this gives you the rollback dialogue shown in this article (read this from the section titled 'Rollback Available in the UI Now', it gives you all the remaining detail to get you in the right direction). The interface is a little clumsy, but should do the job.

SingerOfTheFall
  • 29,228
  • 8
  • 68
  • 105
0

You can accomplish this from the Visual Studio Command Prompt and you don't even need to have a local copy of the code:

# create a temporary folder
mkdir some-workspace && cd some-workspace

# create a temporary workspace
tf workspace /new /collection:http://tfs-host:8080/tfs/some-collection some-workspace

# negate a specific changeset
tf rollback /changeset:some-changeset

# check in the rollback
tf checkin

# delete the temporary workspace
tf workspace /delete some-workspace

# delete the temporary folder
cd .. && rd some-workspace
grenade
  • 31,451
  • 23
  • 97
  • 126
0

Right click on your code in Team Explorer and click on view history then select your files one by one and right click on files choose get specific version and then a model window would open. Change type combobox value latest version to changeset number and revert the latest code to previous changeset.

Hope this helps....

sobby01
  • 1,916
  • 1
  • 13
  • 22