hg revert和hg backout有什么区别? [英] What is the difference between hg revert and hg backout?

查看:258
本文介绍了hg revert和hg backout有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hg reverthg backout都还原以前版本所做的更改.两者有什么区别?

Both hg revert and hg backout revert changes made by a former revision. What is the difference between the two?

推荐答案

给出变更集的历史记录:

Given the history of changesets:

A --- B --- C --- D --- E
          [bad]        (*)

hg revert -r B:保持当前版本,但更新工作目录 从版本B开始.它具有撤消更改的补丁程序的作用 CDE.

hg revert -r B: Stay at current revision, but update the working directory as of revision B. It has the effect of a patch that revokes the changes of C, D and E.

hg backout -r C:更新工作目录,使其包含 merge 版本C的 parent (B)和当前版本的副本,保留更改 在两个修订版之间进行修改(工作目录仍包含 版本DE).这具有在E上应用补丁的效果, 撤消仅C的更改.

hg backout -r C: Update the working directory so that it contains the merge of revision C's parent (B) and the current revision, preserving the changes made in between the two revisions (working dir still contains changes of revision D and E). This has the effect of a patch applied on E, undoing the changes of only C.

如果不是所有的C都不好,您可能要编辑一些文件.记得做 hg commit在任何情况下:

You may want to edit some files if not all of C was bad. Remember to do a hg commit in any case:

A --- B --- C --- D --- E --- F
          [bad]              (*)

这篇关于hg revert和hg backout有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆