Mercurial 撤销推送到主分支

发布于 2024-09-17 22:59:00 字数 185 浏览 8 评论 0原文

我不小心将一些尚未准备好的更改推送到了主分支,所以我立即进行了回退。后来我尝试将主干中的新更改合并到我的分支中,但合并效果不佳。特别是,它似乎认为撤销意味着我希望撤消所有更改。幸运的是,我修改的文件都没有被主分支上的更改修改,所以我可以将文件恢复到本地,但如果存在冲突,那就会很混乱。在这种情况下我放弃了正确的做法,或者我可以做些什么来避免以后潜在的冲突。

I accidentally pushed some changes to the main branch which weren't ready, so I immediately did a backout. Later I tried merging new changes from the trunk into my branch, but the merge didn't work very well. In particular, it seemed that it thought the backout meant that I wanted all of my changes undone. Fortunately, none of the files that I had modified were modified by the changes on the main branch, so I could just revert the files to local, but if there had been conflicts, this would have been messy. Was backing out the right thing to do in this situation, or is there something else I could have done to avoid potential conflicts later.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

前事休说 2024-09-24 22:59:00

您想要回滚而不是回退。回滚是对最后一次拉取(或收到的推送)或提交的一级撤消。取消,应用您指定的变更集的逆操作。

例如,如果您进行了一次提交并意识到提交消息中存在拼写错误,您可以回滚(前提是您没有进行其他拉取或提交。另一方面,如果您意识到你的新线程调度程序是一个糟糕的选择,你想撤消它,然后你进行回退,以便历史记录反映你所走的路径并决定反对——因为

如果你想撤消推送, 这也是有价值的信息。 ,您需要登录接收端并在那里进行回滚。

You wanted rollback not backout. Rollback is a one-level undo of the last pull (or received push) or commit. Backout, applies the inverse of the changeset you specify.

If, for example, you do a commit and realize you had a typo in the commit message you can rollback (provided you've done no other pulls or commits. If, on the other hand, you realize that your new thread scheduler was a bad choice and you want to undo it, then you do a backout, so that the history reflects the path you went down and decided against -- because that's valuable info too.

If you want to undo a push, you need to login to the receiving side and do the rollback there.

通知家属抬走 2024-09-24 22:59:00

我也发生过。万一它对其他人有帮助:
无论如何,我的存储库不应该允许推送。这样做,放入您的 .hg/hgrc 文件:

[hooks]
prechangegroup = false

也就是说,如果您想阻止任何人推送到该存储库。

Happened to me too. In case it helps any one else:
My repository shouldn't have allowed pushes anyway. Do do that, put in your .hg/hgrc file:

[hooks]
prechangegroup = false

That is, if you want to prevent anyone from pushing into that repository.

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