从 Mercurial 分支中删除错误的提交
我遇到了以下问题:
我有 2 个命名分支,它们是产品的 2 个完整版本(例如 A 和 B),而在某个时刻我需要引入从 A 到 B 的更改,所以我启动了以下命令:
hg merge A
之后提交并推送...而不是 2 个分支,我得到了 1 个分支,这对我来说是意想不到的,因为我只想用 A 中的更改更新 B。不知何故,我设法再次获得 2 个分支,现在我想删除分支中的最后一次提交B并且找不到最好的方法(我想说任何方式)来做到这一点。
谢谢。
I've got the following problem:
I have 2 named branches which are 2 completely versions of the product (e.g A and B) than at some moment I was needed to introduce changes from A to B so I started the following command:
hg merge A
after that commit and push ... and instead of 2 branches I've got 1 that was unexpected for me since I wanted just update B with changes in A. Somehow I managed to get again 2 branches and now I want to delete last commit in branch B and cant find the best way (I'd say any way) to do it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需继续致力于您希望仍然存在的分支即可。有一个命令可以明确终止一个分支,但如果您不使用它,所有分支仍然并行存在。如果您没有看到它们,那只是因为查看它们的工具没有显示全部(如果它们没有不同),但它们仍然存在。只要继续与这些分支机构合作就可以了。
现在要删除变更集,您“不能”像真正删除它一样,但您可以提交与该特定变更集完全相反的内容。执行此操作的命令是
backout
。Just continue commiting to the branch that you want stil alive. There is a command to explicitely kill a branch but if you don't use it, all branches are still alive in parallel. If you don't see them it's only because the tool to see them don't show them all if they are not different, but they're still present. Just continue to work with those branches and it will be fine.
Now to remove a changeset, you "can't" as in really removing it, but you can commit an exact inverse of that specific changeset. The command to do this is
backout
.