eclipse Mercurial Eclipse插件中的rollback、backout和strip有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5371159/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:04:22  来源:igfitidea点击:

What is the difference between rollback, backout and strip in the Mercurial Eclipse plugin?

eclipsemercurialrollback

提问by Horcrux7

What is the difference between the menu items rollback, backout and strip in the Mercurial Eclipse plugin?

Mercurial Eclipse 插件中的菜单项回滚、退出和剥离有什么区别?

Can I delete the commit in the local repository without modify the files in my workspace with one of this 3 commands?

我可以删除本地存储库中的提交而不使用这 3 个命令之一修改我的工作区中的文件吗?

Or is there another solution how I can commit and push a fix on another part of the project? My current work is not finish and I can not push it. But I must checkin a quick fix for another part of the project.

或者是否有另一种解决方案,我可以如何在项目的另一部分提交和推送修复?我目前的工作没有完成,我无法推动它。但是我必须为项目的另一部分签入快速修复程序。

The only solution that I see is to create a second workspace. But this look like a overkill for me.

我看到的唯一解决方案是创建第二个工作区。但这对我来说似乎有点矫枉过正。

回答by Ry4an Brase

These commands all come from Mercurial itself, and there are plenty of good compare/contrast posts for them. However, here they are in brief:

这些命令都来自 Mercurial 本身,并且有很多很好的比较/对比帖子。但是,这里是简短的:

  • rollback: one-level undo. Will undo the last pull or commit (can be dangerous)
  • backout: create a new commit that is the inverse of a given commit. Net effect is an undo, but the change remains in your history.
  • strip: remove (destroy) changes from history. Removing a changeset also removes all of its children, so it can only be used to truncate history, not remove a slice.
  • rollback: 一级撤消。将撤消最后一次拉取或提交(可能很危险
  • backout: 创建一个与给定提交相反的新提交。净效应是撤销,但更改仍保留在您的历史记录中。
  • strip:从历史记录中删除(销毁)更改。删除变更集也会删除其所有子项,因此它只能用于截断历史记录,而不能删除切片。

All three are very well described here: http://www.selenic.com/mercurial/hg.1.html

这三个都在这里得到了很好的描述:http: //www.selenic.com/mercurial/hg.1.html

To your question 2, you could use stripto remove the most recent commit and it won't alter you working directory diles.

对于您的问题 2,您可以使用strip删除最近的提交,它不会改变您的工作目录 diles。

To your question 3, you can easily make changes on another part of this project:

对于您的问题 3,您可以轻松地对该项目的另一部分进行更改:

hg commit -m 'commit your half done work'
hg update OLDERCHANGESET # your working directory now is without the half-done-work
.. do that quickfix ...
hg commit -m 'quickfix'
hg push tip # this pushes the tip revision (latest) and its ancestors, but the half-don't work isn't an ancestor so it doesn't get pushed
hg update HALFDONEWORK # you can find the right revision number using "hg heads"

That's call an "anonymous branch" and it's a very common way to work. You do end up committing the half-completed feature, but you can resume it later and you don't have to push it.

这就是所谓的“匿名分支”,这是一种非常常见的工作方式。您最终会提交半完成的功能,但您可以稍后恢复它,而不必推送它。

This has a great explanation of anonymous branches: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/#branching-anonymously

这对匿名分支有很好的解释:http: //stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/#branching-anonymously