放弃更改而不删除历史记录 [英] Abandoning changes without deleting from history

查看:87
本文介绍了放弃更改而不删除历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个提交只是行不通,所以我想放弃它而不将其从历史记录中删除.

There is a commit that just didn't work, so I want to abandon it without deleting it from history.

我已经从较早的修订版进行了更新并提交,因此创建了新的负责人.

I have updated from an earlier revision and committed, thus creating a new head.

我没有分支,我不需要分支,我只想简单地按原样继续使用新的头,没有任何幻想,没有合并,没有后顾之忧,只是继续忘记上一个.

I don't have branches, I don't want branches, I just want to simply go on with the new head exactly as it is, nothing fancy, no merge, no worries, just go on forgetting the previous one.

我似乎找不到解决方法,而且我开始相信它无法完成.我发现的只是关于分支的东西,或者是关于合并的东西.

I can't seem to find how to do that, and I'm starting to believe it can't be done. All I find is stuff about branches, or stuff about merging.

推荐答案

将您的存储库更新到您要忘记的修订版的开头,然后使用hg commit --close-branch将该(匿名)分支标记为已关闭.然后更新到您要要做的分支的头,然后继续工作.

Update your repository to the head with the revision that you want to forget about, then use hg commit --close-branch to mark that (anonymous) branch as closed. Then update to the head of the branch that you do want, and continue working.

如果在hg heads中使用-c选项,您仍然可以看到封闭的分支,但是默认情况下它不会显示,并且hg merge将不尝试与封闭的头合并.

You can still see the closed branch if you use the -c option to hg heads, but it won't show up by default and hg merge will know not try to merge with the closed head.

第一次将这个封闭的磁头推到另一个存储库时,您将需要使用hg push --force,因为在您推送时实际上是在远程存储库中创建其他磁头.因此,告诉Mercurial,使用--force可以.拉紧头部的人不会受到任何警告的困扰.

You will need to use hg push --force the first time you push this closed head to another repository since you are actually create additional heads in the remote repository when you push. So tell Mercurial that this is okay with --force. People who pull the closed head wont be bothered by any warnings.

这篇关于放弃更改而不删除历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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