Rollback or Undo a Changeset in TFS 2010 Version Control

Ed Blankenship
EdSquared
Published in
2 min readFeb 2, 2010

Updated — 8/19/2011 — New Rollback Features Available in the UI with TFS 2010 Power Tools (See Below for More Details)

One of the new features for TFS 2010 Version Control is the ability to rollback or undo a changeset or check-in inside the product and see it as a new pending change type (and new change type in the history) inside Team Explorer. This feature has been available in TFS 2008 but you had to use the TFS Power Tools. The only gotcha for the TFS 2010 implementation is that you have to use the command-line application tf.exe to actually perform the rollback operation. More information about the tool is available here in the MSDN Library: http://msdn.microsoft.com/en-us/library/dd380776(VS.100).aspx

The syntax is:

tf rollback /changeset:changesetfrom~changesetto [itemspec] [/recursive]
[/lock:none|checkin|checkout] [/version:versionspec]
[/keepmergehistory] [/noprompt] [/login:username,[password]]

tf rollback /toversion:versionspec itemspec [/recursive]
[/lock:none|checkin|checkout] [/version:versionspec]
[/keepmergehistory] [/noprompt] [/login:username,[password]]

Versionspec:
Date/Time D”any .Net Framework-supported format”
or any of the date formats of the local machine
Changeset number Cnnnnnn
Label Llabelname
Latest version T
Workspace Wworkspacename;workspaceowner

image
image

Rollback Available in the UI Now

If you have the August 2011 or later version of the TFS 2010 Power Tools installed, you now have the ability to fire off a rollback straight from Team Explorer without having to use the command-line approach. The main way would be to fire it off from the Source Control Explorer window.

However, you can start the rollback process from the Changeset History window as well.

Ed Blankenship

--

--

Ed Blankenship
EdSquared

Product Director at Akeneo | Formerly at Contentful, Algorithmia, and Microsoft in DevOps