SVN版本回滚问题
我正在使用 SVN (TortoiseSVN),并且经常遇到以下情况:
我想放弃自特定(旧)修订版以来的任何更改,并将所有文件返回到该特定(旧)版本。然后我想进一步工作,就好像这个特定的(旧的)修订版是最新的,即我希望能够将特定的旧修订版提交为新修订版。
我找到了解决此问题的几种解决方案(例如 stackoverflow.com/questions/402159/roll-back-or-revert-entire-svn-repository-to-an-older-revision 或 rustyrazorblade.com/2007/04/how-回滚提交到 svn 中存储库的早期版本/)。
但是,我想知道是否有一种简单的方法可以回滚到特定修订版。我认为版本控制正好适合这样的事情(或者我误解了什么?)。
是否有一个简单的命令/按钮/等。这需要将我的本地存储库更新为旧版本并声明它是最新版本?
由于我认为没有“内置”功能可以执行此操作,因此我想知道是什么原因导致开发人员决定不集成此功能。有人知道这个吗?
I'm using SVN (TortoiseSVN) and often came into the following situation:
I wanted to discard any changes since a specific (old) revision and turn all files back to this specific (old) version. Then I wanted to work further as if this specific (old) revision was the newest one, i.e. I wanted to be able to commit the specific old revision as a new revision.
I found several solutions for this problem (for example stackoverflow.com/questions/402159/roll-back-or-revert-entire-svn-repository-to-an-older-revision or rustyrazorblade.com/2007/04/how-to-roll-back-commits-to-an-earlier-version-of-a-repository-in-svn/).
However, I wonder if there is a simple way to roll back to a specific revision. I thought version control is just good for such things (or am I misunderstanding something?).
Is there a simple command/button/etc. that takes an updates my local repository to an old revision and declares it to be the newest one?
Since I suppose that there is no "built-in" function to do this, I wanted to know what reason lead the developers to the decision not to integrate this feature. Does anybody know this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不管出于什么原因,SVN 人员决定将此称为“反向合并”。在 TortoiseSVN 合并对话框中,选中反向合并框,并确保修订框显示类似
HEAD-324
(其中 324 是您要返回的版本)。For whatever reason, the SVN folk decided to refer to this as a "Reverse Merge." In the TortoiseSVN Merge dialog, check the Reverse Merge box, and make sure the revisions box reads something like
HEAD-324
(where 324 is the version you're going back to).在 TortoiseSVN 中,有一种更简单(或者至少更直观的恕我直言)的方法来做到这一点。我认为它实际上在幕后做的是其他人提到的“反向合并”。
In TortoiseSVN there is an easier (or at least more intuitive IMHO) way to do this. I assume that what it's actually doing behind the scenes is the "reverse merge" that others mentioned.
我不确定我是否正确理解您,因为例如您引用的链接(回滚或恢复整个 svn 存储库到旧版本)已经有解决方案:反向合并(如 Powerlord 提到的)。
来自 TSVN 合并文档:
我认为要记住的重要一点是,您不要“回滚更改”,而是“将它们合并”,然后重新提交。可以这么说,你“继续前进”(因为 SVN 中没有“逆转”;毕竟它是版本控制,不应该“忘记事情”:))。
如果您不小心提交了由于某种原因绝对不能在存储库中的内容,您必须(并且可以)更加努力地“再次将其取出”(也在您链接的线程中进行了描述:备份和恢复)。
I am not sure if I understand you correctly since for example the link you quoted (Roll back or revert entire svn repository to an older revision) already has the solution: reverse merge (as Powerlord mentioned).
From the TSVN merge-documentation:
I think the important thing to have in mind is that you do not "rollback the changes" but "merge them out" and then re-commit. You "keep going forward" so to speak (because there is no "reversing" in SVN; it's version control after all, not supposed to "forget things" :)).
If you accidentally committed something that for some reason absolutely cannot be in the repository, you have to (and can) go greater lengths to "get it out again" (also described in the thread you linked: backup and restore).
我会将当前的主干移动到分支中以便安全保存,然后在您想要恢复为主干的修订号处复制一份。
I would move the current trunk into a branch for safe keeping, and then make a copy at the revision number you want back to being the trunk.