2
  1. we committed some code by accident to TFS using VS2013 which created let's say changeset 2.
  2. In order to fix this mistake we did a rollback of changeset 2 to the local machine
  3. We then committed the rollback of changeset 2 thus creating changeset 3
  4. Now we wanted to get the code we originally mistakenly checked in (from step 1) on the local machine so we did "Get Specific Version" and selected changeset 2 so we have changeset 2 on the local machine
  5. we made the changes we wanted on the local machine which now has changeset 2

What are the steps to commit changeset 2 with the corrections back to TFS so we can create changeset 4? (the files are no longer marked as changed)

Denis
  • 11,796
  • 16
  • 88
  • 150
  • You can only merge between branches, so at the very least you need to make your changes on a different branch than they were originally one. However, from experience, all I can say is good luck. TFS is extremely finicky when it comes to rollbacks. – Lasse V. Karlsen Jul 22 '14 at 19:40
  • @LasseV.Karlsen I don't think Denis means merge as in branching and merging. – DaveShaw Jul 22 '14 at 19:43
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Jul 22 '14 at 20:09
  • @DaveShaw I don't think either of us knows what he means by merging. Judging by the comment he posted on your answer, I'd say that he doesn't either, since merging the original changeset with the topmost one, *after* he already removed those changes, would just remove them again. – Lasse V. Karlsen Jul 22 '14 at 20:20
  • I would like to discard the changes in changeset 3 (those were temporary so the world doesn't crumble until I fix changeset 2) and replace them with changeset 2 + changes that fixed issues that forced me to rollback changeset 2 (call all of this changeset "2.1"). – Denis Jul 22 '14 at 20:30

1 Answers1

4

There are 2 options.

The first is to rollback the rollback. This has the downside of marking all the files as Rolled-Back.

The second is to do the "Get Specific Version" for C2, copy the files that are changed out of source control. Perform a "Get Latest" and copy them back in. This could be a pain if this is a large changeset.

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • 1
    really, there is no way to just tell TFS to "merge this changeset with the latest in TFS" and let the user dictate how to resolve conflicts? – Denis Jul 22 '14 at 20:00
  • No, get specific version, just gets you the code as it was at that point in time. – DaveShaw Jul 22 '14 at 20:05
  • You have *already* "merged" that changeset with the latest in TFS, but you did that by removing those changes. So you want to ask TFS to go back to changeset 2, and then merge that with the latest changeset, but that would only get you back to square 1 because those changes were removed in changeset 3, and thus TFS would see that "hey, you want those changes, but they were specifically removed, but I can merge that, I'm just going to go with the removal". @DaveShaw has it right. You need to either rollback the rollback, or reintroduce the changes. – Lasse V. Karlsen Jul 22 '14 at 20:21
  • Don't understand why that would get me to square 1. I would like to checkin changeset 2 back in + fixes that made that changeset good i.e. I would like to checkin an enhanced changeset 2 (call it changeset "2.1") but I would like that to be the latest changeset for the affected files. – Denis Jul 22 '14 at 20:32
  • If you rollback the rollback, you have C2 as pending changes - you can add more changes to make 2.1. If you copy the files out and back in, you have C2 as pending changes - you can add more changes to make 2.1. – DaveShaw Jul 22 '14 at 20:38
  • Hmmm, I see, rollback the rollback sounds right - make the additional changes and then check back in. Wow, this is so complicated! This was so much easier with svn... – Denis Jul 22 '14 at 20:41