Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to revert (Roll Back) a checkin in TFS 2010

Tags:

rollback

tfs

Can anyone tell me how to revert (roll back) a checkin in TFS 2010?

like image 695
devlife Avatar asked Apr 22 '10 21:04

devlife


People also ask

How do I revert to a previous commit in TFS?

To do it, go to commit you want to revert, then open the file you want to revert back. Then paste it to the same file in local, then push it to your repo. You could undo change to the local file after committing. Hope that could help.

How do you delete a changeset in TFS?

You cannot delete a changeset in TFS. Even if you could somehow, (I think you can run a sql query against the TFS database to do that) its not a good practice. If people start deleting changesets/history the whole purpose of version control will be defeated.


2 Answers

You have two options for rolling back (reverting) a changeset in Team Foundation Server 2010 Version Control. First option is using the User Interface (if you have the latest version of the TFS 2010 Power Tools installed).

Rollback Changeset in UI for TFS 2010

The other option is using the TFS 2010 version control command-line application:

tf.exe rollback 

I have information about both approaches on my blog post.

For Team Foundation Server 2012, 2013, or Visual Studio Online, rollback is now built-in directly to Source Control Explorer and when you are opening a changeset's details in the Team Explorer Window. You do not need to install any release of the Power Tools for this functionality when using Visual Studio 2012 or later. There is a great MSDN article discussing details about rolling back a changeset now available here: http://msdn.microsoft.com/en-us/library/ms194956(v=vs.110).aspx

like image 124
Ed Blankenship Avatar answered Oct 21 '22 07:10

Ed Blankenship


For 2010, use the rollback command from the command line. There is not integrated support in the IDE for this, as of yet.

Rollback command

Basically, the way that it works is that it creates an "anti-delta" to negate the impacted changeset. You can accomplish the same thing manually by doing a Get Specific Version, adding a space to the file so it looks like it changed, and checking it in. I still go the latter route to back out a change if I need to for a single file, as I find it quicker to do.

like image 32
Joseph Ferris Avatar answered Oct 21 '22 06:10

Joseph Ferris