(Mercurial) 有什么方法可以返回并标记分支的开始吗?

发布于 2024-12-15 10:58:22 字数 524 浏览 1 评论 0原文

我愚蠢地未能在 default 主干上启动一个分支来进行一些实验性工作,现在意识到我所做的并不是那么好。由于此代码实际上已被其他人使用(并且在野外),因此我想将修订版 394 (本实验中未进行的最后一个更改)标记为正确的头,并基本上删除我想要的任何内容。已经完成了)。最好的方法是什么?

@ 397 my change, bad (tip)
|
|
o 396 my change, bad
|
|
o 395 my change, bad
|
|
o 394 good change
|
|
...

这应该变成

@ 394 good change (tip)
|
|
|- 397 bad change (closed)
||
||
|o 396 bad change
||
||
|o 395 bad change
|/
|
...

我是否需要根据 394 进行虚拟签入(这会自动创建一个新头)?这似乎是最简单的解决方案,但不是“最干净的”。

I foolishly failed to start a branch off the default trunk to do some experimental work, and now realize that what I've done isn't really all that great. Since this code is actually used by others (and out in the wild), I want to mark revision 394 (the last change not made in this experiment) as the proper head, and basically strip off anything I've done). What would be the best way to do that?

@ 397 my change, bad (tip)
|
|
o 396 my change, bad
|
|
o 395 my change, bad
|
|
o 394 good change
|
|
...

This should become

@ 394 good change (tip)
|
|
|- 397 bad change (closed)
||
||
|o 396 bad change
||
||
|o 395 bad change
|/
|
...

Do I need to make a dummy check-in based off of 394 (which would create a new head automatically)? That seems the simplest solution, but not the "cleanest".

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

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

发布评论

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

评论(1

雨后彩虹 2024-12-22 10:58:25

你不需要虚拟签到,但你需要确保你的下一次签到是从 rev 394 开始完成的。

hg update -r 394
<do work>
hg commit

新的头部将是小费。


或者,如果您没有将存储库推送到任何地方[1],并且您只想永久删除这些修订,则可以使用 mq 扩展,并strip 更改集或 qimport 将它们放入补丁队列并 qdel 补丁。

hg strip 395                   # Will strip rev 395 and it's descendants

这很危险,一定要确保正确。


[1] 如果您已经将变更集发送到任何地方,但为时已晚,则秘密将被泄露。你只需要从 rev 394 分支出来。

You don't need a dummy check-in, but you do need to make sure your next check-in is done from rev 394.

hg update -r 394
<do work>
hg commit

The new head will be the tip.


Alternatively, if you haven't pushed the repo anywhere[1], and you just want to delete those revisions forever you can use the mq extension, and either strip the changesets or qimport them into a patch queue and qdel the patches.

hg strip 395                   # Will strip rev 395 and it's descendants

This is dangerous, make sure you get it right.


[1] If you've already sent the changesets anywhere, too late, the cat's out of the bag. You'll just have to branch off rev 394.

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