SVN版本回滚问题

发布于 2024-08-25 14:26:32 字数 506 浏览 7 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梨涡少年 2024-09-01 14:26:32

不管出于什么原因,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).

就像说晚安 2024-09-01 14:26:32

在 TortoiseSVN 中,有一种更简单(或者至少更直观的恕我直言)的方法来做到这一点。我认为它实际上在幕后做的是其他人提到的“反向合并”。

  1. 右键单击要回滚的文件/文件夹。
  2. 从 TortoiseSVN 菜单中单击“显示日志”。
  3. 选择您要撤消的修订。
  4. 右键单击这些修订。
  5. 选择“恢复此版本的更改”——不要与“恢复到此版本”混淆!
  6. 单击“是”
  7. 请记住,这只会更改您的工作副本。确认这执行了您期望的操作,然后提交,在日志消息中添加有关“回滚”或“反向合并”的内容

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.

  1. Right-click on the file/folder you want to roll back.
  2. Click "Show log" from the TortoiseSVN menu.
  3. Select the revision(s) you want to undo.
  4. Right-click on those revisions.
  5. Select "Revert changes from this revision" -- not to be confused with "Revert to this revision"!
  6. Click "Yes"
  7. Remember that this only changes your working copy. Confirm that this did what you expected it to do, and then commit, putting something in your log message about "rolling back" or "reverse merging"
骄兵必败 2024-09-01 14:26:32

我不确定我是否正确理解您,因为例如您引用的链接(回滚或恢复整个 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:

If you want to merge changes back out
of your working copy, to revert a
change which has already been
committed, select the revisions to
revert and make sure the Reverse merge
box is checked.

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).

伴梦长久 2024-09-01 14:26:32

我会将当前的主干移动到分支中以便安全保存,然后在您想要恢复为主干的修订号处复制一份。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文