ChevCast
ChevCast

Reputation: 59213

How to revert a changeset in team foundation server?

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?

Upvotes: 11

Views: 9158

Answers (5)

tdavisjr
tdavisjr

Reputation: 486

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!

Upvotes: 6

grenade
grenade

Reputation: 32179

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

Upvotes: 0

Chris Halcrow
Chris Halcrow

Reputation: 11

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.

Upvotes: 1

sobby01
sobby01

Reputation: 2154

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....

Upvotes: 0

Paul G
Paul G

Reputation: 2742

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

Upvotes: 3

Related Questions