从 Mercurial 分支中删除错误的提交

发布于 2024-11-17 20:09:31 字数 278 浏览 2 评论 0原文

我遇到了以下问题:

我有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

用心笑 2024-11-24 20:09:31

只需继续致力于您希望仍然存在的分支即可。有一个命令可以明确终止一个分支,但如果您不使用它,所有分支仍然并行存在。如果您没有看到它们,那只是因为查看它们的工具没有显示全部(如果它们没有不同),但它们仍然存在。只要继续与这些分支机构合作就可以了。

现在要删除变更集,您“不能”像真正删除它一样,但您可以提交与该特定变更集完全相反的内容。执行此操作的命令是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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文