17

In Visual Studio 2013 Update 3, I accidentally checked in a not-compiling, work-in-progress changeset that I intended to shelve in order for a co-worker to take. I rolled back the change set right away. Bad me.

Is there a way to recover that bad/rolled-back changeset as a Pending Changes so that I (or my co-worker) may continue to work on it? I didn't see anything in the UI and had to manually pull out each file and construct the pending changes by hand. It was only 20 minutes of work to code it originally, so not that big a deal (it was my error) but I'm curious if there was a better way.

Craig Celeste
  • 12,207
  • 10
  • 42
  • 49
  • This is admittedly not a normal use case, so maybe there is no solution apart from manually digging out each file. Also, I'm curious how often people make this mistake. I have been using Visual Studio and TFS for years and haven't done so before, but then again I don't create shelvesets very often. The check-in and shelf UI are very similar looking. – Craig Celeste Jan 02 '15 at 15:14
  • 3
    Unfortunately I'm stuck on an ancient TFS server that doesn't natively support rollback - but does the rollback not generate a new changeset that is actually committed to achieve the rollback? If so, does the tooling not let you generate a rollback of *that* changeset? – Damien_The_Unbeliever Jan 02 '15 at 15:41
  • I was a bit annoyed and on tilt when it happened. But yeah, that would probably work! Thanks – Craig Celeste Jan 02 '15 at 17:25
  • Also (unrelated) Visual Studio introduced rollback in (I think) Visual Studio 2013. But TFS has supported it for quite a while via the command line. Depending how ancient your TFS is, it might have it. http://msdn.microsoft.com/en-us/library/dd380776%28v=vs.100%29.aspx – Craig Celeste Jan 02 '15 at 17:27
  • Unfortunately, I still live in a 2008 world (for the server) and so have to use the power tools version. I knew it become native later but I'm only (unfortunately) familiar with the 2008 variant. That's why I wasn't confident enough to post this as an answer. – Damien_The_Unbeliever Jan 02 '15 at 17:53

1 Answers1

38

As was said in the comments, you can "rollback the rollback". I do it all the time. Just find the rollback changeset in history, and roll that back, and it will get you your half-finished changes into your local workspace, so you can continue working on them and check them in when done.

Dylan Smith
  • 22,069
  • 2
  • 47
  • 62