Mercurial 撤销推送到主分支
我不小心将一些尚未准备好的更改推送到了主分支,所以我立即进行了回退。后来我尝试将主干中的新更改合并到我的分支中,但合并效果不佳。特别是,它似乎认为撤销意味着我希望撤消所有更改。幸运的是,我修改的文件都没有被主分支上的更改修改,所以我可以将文件恢复到本地,但如果存在冲突,那就会很混乱。在这种情况下我放弃了正确的做法,或者我可以做些什么来避免以后潜在的冲突。
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要
回滚
而不是回退
。回滚是对最后一次拉取(或收到的推送)或提交的一级撤消。取消,应用您指定的变更集的逆操作。例如,如果您进行了一次提交并意识到提交消息中存在拼写错误,您可以
回滚
(前提是您没有进行其他拉取或提交。另一方面,如果您意识到你的新线程调度程序是一个糟糕的选择,你想撤消它,然后你进行回退,以便历史记录反映你所走的路径并决定反对——因为如果你想撤消推送, 这也是有价值的信息。 ,您需要登录接收端并在那里进行回滚。
You wanted
rollback
notbackout
. 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.
我也发生过。万一它对其他人有帮助:
无论如何,我的存储库不应该允许推送。这样做,放入您的 .hg/hgrc 文件:
也就是说,如果您想阻止任何人推送到该存储库。
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:
That is, if you want to prevent anyone from pushing into that repository.