如何撤消合并(不提交)?

发布于 2024-08-14 03:24:25 字数 296 浏览 2 评论 0原文

我刚刚做了一个 svn merge 将更改从主干合并到分支:

$ svn merge -r328:HEAD file:///home/user/svn/repos/proj/trunk .
--- Merging r388 through r500 into '.':
A    foo
A    bar
   C baz1
   C baz2
U    duh
[...]

但是冲突太多,所以我想撤消它。

一种方法是提交然后合并回来。但由于冲突,我无法承诺。在这种情况下撤消的最佳方法是什么?

I just did an svn merge to merge changes from the trunk to a branch:

$ svn merge -r328:HEAD file:///home/user/svn/repos/proj/trunk .
--- Merging r388 through r500 into '.':
A    foo
A    bar
   C baz1
   C baz2
U    duh
[...]

But there were too many conflicts, so I'd like to undo that.

One way to do that is to commit and then merge back. But I can't commit because of the conflicts. What's the best way to undo in that case?

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

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

发布评论

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

评论(5

眼藏柔 2024-08-21 03:24:25

从工作副本的顶部递归恢复:

svn revert -R。

您将需要手动删除已添加的文件。与恢复后一样,添加的文件将保留在磁盘上,但它们将处于非跟踪状态(“?foo”)

Revert recursively from the top of your working copy:

svn revert -R .

You will need to manually delete the files that were added. As in after reverting, the files added will remain on disk but they will be in a non-tracked state ("? foo")

泛泛之交 2024-08-21 03:24:25

只要您尚未提交,您就可以随时进行恢复以撤消所有更改。

As long as you haven't commited, you can always do a revert to undo all your changes.

浅忆流年 2024-08-21 03:24:25

我面临着同样的情况,而且我还有一些我不想失去的其他变化。
因此,对于冲突的项目,不需要完全递归恢复,而只需 svn revert 对我来说是有好处的

svn revert baz1 baz2

I faced the same situation, also I had some other changes which I didn't wanted to lose.
So, instead of full recursive revert just svn revert for the conflicted items was good for me

svn revert baz1 baz2
心清如水 2024-08-21 03:24:25

如果您还没有提交更改,您可以执行 TortoiseSVN ->单击恢复并选择未提交的更改并恢复

如果您已提交并且想要撤消更改,则 SVN 日志 ->选择修订版,右键单击,然后恢复该特定修订版的更改。然后提交代码

If you haven't committed the changes, you can do TortoiseSVN -> click Revert and select the Uncommitted changes and revert

If you have committed and if you want to Undo the changes then SVN logs -> select the revision, right click and then Revert the changes of that particular revision. then commit the code

霞映澄塘 2024-08-21 03:24:25

无论如何,只要对所有冲突执行svnresolve并提交:

$ svn resolved baz1
$ svn resolved baz2
$ svn ci -m "oops. bad merge. will revert."
Transmitting file data ......
Committed revision 501.

然后,通过合并回原来的位置来正式撤消它:

$ svn merge -r501:500
--- Reverse-merging r319 into '.':
[...]

就是这样,合并已在目录中撤消。现在也提交一下:

$ svn ci -m "bad merge has been undone"
Transmitting file data ......
Committed revision 502.

相对于 svn revert -R . 方法的优点是添加的文件都被正确删除。

Just do svn resolve on all conflicts anyway and commit:

$ svn resolved baz1
$ svn resolved baz2
$ svn ci -m "oops. bad merge. will revert."
Transmitting file data ......
Committed revision 501.

Then, officially undo it by merging back to where it was:

$ svn merge -r501:500
--- Reverse-merging r319 into '.':
[...]

That's it, the merge has been undone in the directory. Now commit that too:

$ svn ci -m "bad merge has been undone"
Transmitting file data ......
Committed revision 502.

The advantage over the svn revert -R . method is that the files that were added are all properly removed.

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