0

I need some help figuring out what the best thing to do is in this situation:

I have been developing some code on the trunk of a project. Recently I discovered that there are some problems with it, so I checked out an older revision of the project that I made some changes to.

Now I would like this older, modified checkout to be the head of the trunk. The problem is that I can't just check in this older version. I basically want to undo the last 5 commits and check in the changes I'm currently working on.

What's the best way to do this?

Q-bertsuit
  • 3,223
  • 6
  • 30
  • 55

1 Answers1

1

As you've already realised, you can't just commit your local changes because your working copy is out-of-date. You can try this:

  1. Check out a new fresh working copy somewhere else
  2. Launch the "SVN Show log" dialogue
  3. Highlight all five invalid commits
  4. Right click on them and select "Revert changes from these revisions"
  5. Review changes and commit them with a meaningful message: "Undo changes from blah blah..."

(This is how you should have proceeded in the first place.)

Now, head to your current working copy. Use your favourite file compare tool to copy pending changes to the other working copy (that one that's up-to-date) and commit them if necessary.

Now both working copies contain the same code—you should be able to update the first one and continue development there (or simply discard it and develop in the second one).

Álvaro González
  • 142,137
  • 41
  • 261
  • 360