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

夙愿已清 提交于 2019-12-02 15:24:29

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

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

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

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

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!