Mercurial 中恢复和更新之间的区别
我刚刚开始使用 Mercurial,遇到了一些我不明白的事情。
我对多个文件进行了更改,现在我想撤消对其中一个文件所做的所有更改(即返回到一个特定文件的最后一次提交)。
据我所知,我想要的命令是 revert。
在我链接到的页面中,有以下声明:
但是此操作不会改变 工作的父版本 目录(或修订,如果 未提交的合并)。要撤消 未提交的合并,可以使用“hg update -C -r.” 这将重置 父母到第一个父母。
我不明白两者之间的区别(hg revert
与 hg update -C -r
)。谁能告诉我其中的区别吗?就我而言,我真的希望恢复或更新能够消除我对文件所做的更改吗?
I'm just getting started with Mercurial, and I've come across something which I don't understand.
I made changes to several files, and now I want to undo all the changes I made to one of them (i.e. go back to my last commit for one specific file).
As far as I can see, the command I want is revert.
In the page I linked to, there is the following statement:
This operation however does not change
the parent revision of the working
directory (or revisions in case of an
uncommitted merge). To undo an
uncomitted merge, you can use "hg
update -C -r." which will reset the
parents to the first parent.
I don't understand the difference between the two (hg revert
vs. hg update -C -r
). Can anyone enlighten me as to the difference? And in my case, do I really want the revert or the update to go get rid of the changes I made to the file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一个区别是恢复可以对工作副本的子集起作用,而更新可以对整个工作副本起作用。另一个区别是当您想要返回到最后提交的版本以外的版本时会发生什么。
如果我们有修订(大写字母已提交,小写字母是工作副本中的更改,父修订版是 C )
update -C -r B
将为您提供设置为 B 的工作副本,任何更改都会导致从 B 分支(父版本设置为 B)
revert -r B
将为您提供其中 b' 是一组更改,它撤消中间提交的更改中的所有内容,在这种情况下,它撤消所有C. 现在任何更改都只需加入 b' 集(父版本在 C 处保持不变)
The first difference is revert can work on a subset of the working copy while update works on the whole working copy. the other difference is in what happens when you want to go back to a version other than the last committed one.
if we have revisions (caps are committed, lower case are changes in the working copy, parent revision is C )
update -C -r B
will give youwith your working copy set to B, any changes will result in branching from B (parent revision set to B)
revert -r B
will give youwhere b' is a set of changes which undoes everything in the intermediate committed changes, in this case it undoes all of C. any changes now just join the b' set (parent revision left unchanged at C)