0

I'm using Mac OS X terminal for SVN. I'm very amateur when it comes to SVN and command line. I'm typically just a front-end code monkey.

I've accidentally, somehow, committed some branches of our project inside another branch of the project while attempting to check out the branch. Yes, I'm that bad.

Remote repository:

MyProjectBranch
    BranchNeedsToNotBeHere
    BranchNeedsToNotBeHere2
    BranchNeedsToNotBeHere3
    expectedDirectoryStillHere1
    expectedDirectoryStillHere2
    expectedDirectoryStillHere3

Finally correct local repository at desired revision:

MyProjectBranch
    expectedDirectoryStillHere1
    expectedDirectoryStillHere2
    expectedDirectoryStillHere3

How do I undo this travesty without making myself look incompetent? It would seem like a simple "revert" command would be available, but all I've found is "reverse merging" - which, if I've done that right, hasn't removed the extraneous directories at all, and the expected directories are not at the correct revision, but an older one. So I may not even be doing that right.

Much kudos and, when available, bounty to anyone who can save me!

Randy Hall
  • 7,716
  • 16
  • 73
  • 151
  • one option could be to do a fresh checkout in another directory with revision to the point where everything was good. – ashutosh raina Jan 09 '14 at 16:41
  • @ashutoshraina So you're saying... remotely remove the entire branch and then commit the correct one I have locally back in its place? I need to be able to reintegrate this branch to the trunk later as well, would that affect anything? If you can articulate this process in an answer I will get you some points. – Randy Hall Jan 09 '14 at 16:44
  • Just `svn rm` them if you need them gone, `svn mv` them if you need them somewhere else? Yes, your error is still there in the history, but not readily apparent, and probably no one actually cares about that. – Wrikken Jan 09 '14 at 17:13

2 Answers2

1

Revert your commit by doing the following:

svn merge -c -$REV

where $REV is the change that you introduced the directories. If you did it over a range of revisions repeat this for each revision. Note the dash in front of the revision number, it's a minus to imply the reversal of that revision. If the range of revisions you want to remove is the only things committed on the path you can specify the range with -r $YOUNGEST:$OLDEST instead of -c -$REV instead and do a single reverse merge.

If everything is limited to just adding new files/directories, you could just also use svn rm on the paths and remove them.

Ben Reser
  • 5,695
  • 1
  • 21
  • 29
0

First, I think what I am about to say is not the proper way of doing it. It might even be voted down. Go to svn remote and delete the branches that you think should not be there. Update local and you should be done. Take backups before you do this.

Also, I am not sure why deleting the the extra branches locally first and then a commit won't fix this for you. Have you tried that ?

ashutosh raina
  • 9,228
  • 12
  • 44
  • 80