简体   繁体   English

通过命令行撤消SVN 1.6错误

[英]Undo SVN 1.6 mistake via command line

I'm using Mac OS X terminal for SVN. 我正在将Mac OS X终端用于SVN。 I'm very amateur when it comes to SVN and command line. 关于SVN和命令行,我非常业余。 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! 对于任何能救我的人来说,都非常值得赞扬!

Revert your commit by doing the following: 通过执行以下操作还原提交:

svn merge -c -$REV

where $REV is the change that you introduced the directories. 其中$ REV是您引入目录的更改。 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. 如果要删除的修订范围是路径上唯一提交的内容,则可以使用-r $YOUNGEST:$OLDEST而不是-r $YOUNGEST:$OLDEST -c -$REV来指定范围,然后执行一次反向合并。

If everything is limited to just adding new files/directories, you could just also use svn rm on the paths and remove them. 如果只限于添加新文件/目录,则可以在路径上使用svn rm并将其删除。

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. 转到svn remote并删除您认为不应该存在的分支。 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 ? 你尝试过吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM