问题
I did a mistake importing in an import to some SubVersion repository, and I want to revert this import.
How can I do that?
My mistake was this: Given a folder with subfolders
a \
a \ a1
a \ b1
a \ c1
I wanted to import the folder a inside a repository folder F, so the structure in the repository be
F\a
but I imported the folders a1, b1 and c1 and the repository now is
F \ a1
F \ b1
F \ c1
I'm using Tortoise Svn, so if your instructions are in terms of that, are better.
回答1:
svn mkdir repo-base/a
svn mv repo-base/a1 repo-base/a/
svn mv repo-base/b1 repo-base/a/
svn mv repo-base/c1 repo-base/a/
where repo-base is e.g. https://svn.my.net/svn/project/trunk/
then, when you're done, check it out locally.
renaming files and moving whole directories is most reliably achieved by issuing the commands against remote paths in my experience.
回答2:
Is this the first import for the repository? Just nuke, recreate, and re-import (but do it this time).
If you were importing the tree into something other than a brand new repository, you'll have to do a bit more.
回答3:
I see three choices. Using a GUI like TortoiseSVN could make things easier.
Fix it where you're at
Move the folders
Delete repository and try again
Create the repository
Revert change and try again
See Revert to this revision
来源:https://stackoverflow.com/questions/1424449/how-to-revert-a-subversion-import