Rollback a changeset in TFS 2010

Hello World,I guess each one of us has this “bad hair day” when you just can’t get things right. On one such day, I checked in some code to TFS just to realise while testing that I have broken stuff! Now, I came from a background in VSS and SVN as SCM (Software Configuration Management) systems and they both had an option to “Rollback” to the previous version so you could just undo any malaise you may have caused.
I was taken aback when I did not see this option in the context menu in TFS if I right clicked a changeset upto which things were working. One of my colleagues suggested the following:

  1. Do a “Get Specific” with the changeset upto which everything was fine
  2. Checkout all affected files
  3. Resolve conflicts (there should be some)
  4. Checkin the files

You effectively overwrite your changes with the previous changeset.
Some things to note though:

  • If project and solution files were modified, you may need additional checks to ensure they have been rolled back
  • Sometimes, you may need to make some changes so that TFS detects that the files have changed (e.g. add a space at the end of a codefile

Turns out, there is another way to do a rollback through the TF commandline tool (using VS command prompt) as detailed in MSDN although, as the comments at the bottom suggest, you may need to change directory to your workspace.

Happy Coding!

Advertisements
Posted in Visual Studio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • Comic for May 23, 2017
    Dilbert readers - Please visit Dilbert.com to read this feature. Due to changes with our feeds, we are now making this RSS feed a link to Dilbert.com.
%d bloggers like this: