我对 Subversion 比较陌生,来自 Source Safe,这让我抓狂。使用 Tortoise 界面,Commit 不断向我显示 bin 目录中的 .java 文件,它说这些文件“丢失” - 好吧,这是一个单独的问题。基本上,当我尝试了几种方法来消除虚假的“bin”消息时,Tortoise 反而删除了我的整个源目录。我尝试重新添加内容,但是当我添加时,它是新的,没有历史记录。
如何将 Subversion 恢复到特定版本?就好像我从来没有发生过一样?我知道如何在 VSS 中执行此操作,但每次我在 TortoiseSVN 中尝试时,它只会修改我的工作副本。我不想再签入我的工作副本,因为那样会丢失我所有的历史记录。 Subversion 会忘记吗?
顺便说一句,已经尝试在 stackoverflow 中查找,但我发现的最接近的事情是导出并重新导入整个存储库,但我认为我还没有到那一步。 Subversion一定能做到这个最简单的事情!
I'm relatively new to Subversion, coming from Source Safe, and it's driving me nuts. Using the Tortoise interface, Commit kept showing me .java files in my bin directory which it said were "missing" - ok, that's a separate question. Basically, when I tried several things to get rid of the spurious "bin" message, Tortoise instead deleted my entire source directory. I tried re-adding things, but when I added, it came in as new, with no history.
How do I take Subversion back to a particular revision? As if I had never happened? I know how to do this in VSS, but every time I try in TortoiseSVN, it just modifies my working copy. I don't want to then check in my working copy, because that would lose me all my history. Can Subversion forget?
Tried looking in stackoverflow already, btw, but the closest thing I found was exporting and reimporting the entire repository, and I don't think I'm at that point yet. Subversion must be able to do this most simple thing!
发布评论
评论(3)
Subversion 不会忘记,但您可以执行如下操作:
假设您当前的修订版是 100,并且您想返回到修订版 70。您将创建修订版 101,它与 70 完全相同。
1)查看一份干净整洁的工作副本。
2) 合并(向后)更改。
3)检查理智。您的工作副本正是您想要的吗?如果是这样:
svn commit -m“回滚到 r70 的美好时光
”Subversion won't forget, but you can do something like the following:
Let's say your current revision is 100, and you want to go back to revision 70. You'll be creating a revision 101, which is exactly the same as 70.
1) Check out a nice clean working copy.
2) Merge (backwards) changes.
3) Check sanity. Is your working copy exactly what you wanted? If so:
svn commit -m "rolled back to the good old days of r70
"由于您特别询问了 TortoiseSVN,您可以执行以下操作:
然后只需将更改提交到存储库并附带相应的消息即可。
Since you specifically asked about TortoiseSVN you can do the following:
Then just commit your changes to the repository with an appropriate message.
你不会收回SVN;你拿回你的工作副本,然后提交它。
编辑:根据命令是什么(IE,svn cp 而不是 cp),subversion 将记住文件的祖先(历史)。
您可以反向合并它,也可以复制它。复制可能是更好的选择。
如果我要这样做,我会这样做:
但是,可能更好的方法是:
对于我放置“目录”的某些位置,您可能必须使用存储库中位置的 URL ,例如,如果您刚刚删除了根目录(因此没有任何内容可供参考)。无论是合并还是合并,第一个是存储库的 URL,第二个是本地目录……尽管它可能只需要使用本地目录两次即可。
只要记住;如果它不能正常工作,请不要检查它:D
(这是使用第二种方法的优点......而且,它需要更少的数据传输)
You don't take the SVN back; you take your working copy back, and then commit it.
EDIT: depending on what the command is (IE, svn cp instead of cp), subversion will remember the ancestry (history) of the file.
You could either reverse-merge it, or you could copy it. Copying is probably the better choice for this.
If I was going to do it, I would do:
However, the possibly better way to do it, would be:
For some of the places where I put 'directory', you may have to use the URL of the location in the repository, for example, if you just removed the root directory (and thus there's nothing left to reference off of). Either that or with the merge, the first one is the URL to the repo, and the second one is the local directory... though it will probably work with just using the local dir twice.
Just remember; if it didn't work properly, don't check it in :D
(this is an advantage with using the second method... also, it requires less data transfer)