如何回滚全部或部分对 svn 的提交?

发布于 2024-07-14 16:52:26 字数 39 浏览 5 评论 0原文

如何使用 TortoiseSVN 恢复全部或部分 SVN 提交?

How do I revert all or part of an SVN commit using TortoiseSVN?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

东风软 2024-07-21 16:52:26

首先,您需要确定您想要恢复修订版的“所有更改”,还是只是恢复单个文件。 TortoiseSVN只有“1或all”的方法; 也就是说,您可以恢复整个签入集或单个文件:而不是部分签入。

整个变更集

因此,如果恢复特定修订(并且您希望更改该变更集中的所有文件),您将需要右键单击 -> 。 乌龟SVN-> 显示日志。 找到要回滚到的修订/变更集,右键单击该修订“恢复到此修订”。

您可能会对另一个选项感兴趣,即“恢复此版本的更改”,它将在该版本和当前版本之间进行差异合并,并仅合并差异。 有时我发现这更有吸引力; 因此,我可以将所有更改保留在更改集之间。

单个文件

另一个选项是恢复单个文件。 您将再次右键单击 -> 乌龟SVN-> 显示日志; 但这一次,您可以选择单个文件。

TortoiseSVN 不允许您在变更集中选择多个文件来恢复。 要么是全部,要么只是 1。

变更集签入

对于所有其他阅读内容,请确保“签入”仅涉及与该更改相关的文件。 这应该是当今的常见做法; 但是,我仍然发现开发人员在一天结束时“霰弹枪”签入,将当天的所有更改捆绑到一个签入中。

我眯着眼睛看着那些开发人员。 -_^

First, you need to identify rather you want to revert back "all changes" of a revision, or just a single file. TortoiseSVN has only the "1 or all" approach; meaning, you can revert back the entire check-in set, or single files: not partial checkins.

Entire Changeset

So, if reverting back a specific revision (and you want all files in that changeset to be changed), you will want to Right-Click -> TortoiseSVN -> Show log. Find the revision/changeset you want to rollback to, right-click on that revision "Revert to this Revision".

There's another option which might interest you, which is "Revert changes from this revision", which will do a Diff-merge between that revision and your current version, and merge just the differences. I find this more appealing at times; so, I can keep all changes inbetween the changesets.

Single file

The other option is to revert a single file back. You would again do Right-Click -> TortoiseSVN -> Show log; but this time, you can select a single file.

TortoiseSVN does not let you select multiple files in a changeset to revert back to. It's either all, or just 1.

Changeset checkins

For all others reading, make sure "checkins" only involve the files related to that change. This should be common practice these days; but, I still find developers "shotgunning" the checkins at the end of the day, bundling up all changes for the day into a single checkin.

I gleam at those devs with w squint. -_^

苄①跕圉湢 2024-07-21 16:52:26

如果您想恢复以前所做的提交(修订):

使用资源管理器:

  1. 右键单击要恢复的文件/文件夹,
  2. TortoiseSVN->显示日志,
  3. 右键单击不需要的修订,
  4. “恢复更改”此修订版”,
  5. 提交->确定。

如果您想撤消本地所做的更改(未提交)

使用资源管理器:右键单击文件,TortoiseSVN -> 恢复。

If you want to revert previously made commit (revision):

With explorer:

  1. Right click on file/folder you want to revert,
  2. TortoiseSVN->show log,
  3. right click on unwanted revision,
  4. "revert changes from this revision",
  5. commit->OK.

If you want to undo locally made changes (uncommited)

With explorer: Right click on file(s), TortoiseSVN->Revert.

魔法唧唧 2024-07-21 16:52:26

除了 Bartek 所说的之外,您还可以签出对本地工作副本的特定修订,并将其提交回头部。

alternatively to what Bartek said, you can checkout a particuler revision to a local working copy, and commit it back to the head.

花开半夏魅人心 2024-07-21 16:52:26

请注意,您只能在签入新修订版的意义上“恢复”,该修订版不再包含您想要恢复的更改。 其他答案中对此进行了描述。

您实际上无法撤消签入(如“它从未发生过”),旧状态仍将保留在存储库的历史记录中。

真正撤消/删除内容是一个长期存在的功能请求:

http://subversion.tigris .org/issues/show_bug.cgi?id=516

Note that you can only "revert" in the sense that you check in a new revision, which no longer contains the changes you wanted to revert. That is described in the other answers.

You can not actually undo a checkin (as in "it never happened"), the old state will still be in the repository's history.

Really undoing/removing stuff is a longstanding feature request:

http://subversion.tigris.org/issues/show_bug.cgi?id=516

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