如何从特定 Mercurial 克隆中删除某些变更集?

发布于 2024-10-09 14:37:25 字数 294 浏览 0 评论 0原文

我有一个版本为 2048 的中央存储库的克隆。我想删除本地存储库上的最后 10 个变更集,就像我回到了两周前一样。我想我可以删除本地存储库并执行 "hg clone -rev 2038" 但这会很长(克隆存储库需要几分钟)。有没有办法“拉动”一些变更集?

注意:

  • 我并不是想撤销更改集。我最终将再次从中央存储库中提取这些变更集。
  • 我并不是试图将工作目录更新为早期版本;我真的很想影响存储库。
  • 我当前的存储库和工作目录中没有任何传出的更改集或待处理的修改。

I have a clone of a central repo at rev 2048. I want to remove the last 10 changesets on my local repo as if I was back in time two weeks ago. I suppose I could delete my local repo and do "hg clone -rev 2038" but that would be long (cloning the repo takes several minutes). Is there a way to just "unpull" some changesets?

Notes:

  • I'm not trying to backout the changesets. I'll eventually pull those changesets again from the central repo.
  • I'm not trying to update the working directory to an earlier version; I really want to affect the repository.
  • I don't have any outgoing changesets or pending modifications in my current repo and working directory.

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

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

发布评论

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

评论(4

滴情不沾 2024-10-16 14:37:25

使用 strip 命令:

hg strip -r 2039

此命令由 StripExtension 提供。它作为 Mercurial 2.8 及更高版本的一部分进行分发,但您需要首先通过将以下行添加到 .hgrc 或 Mercurial.ini 来启用它:

[extensions]
strip =

在 Mercurial 2.8 之前,它是 MqExtension

为了防止您意外破坏历史记录,该命令将在 .hg/strip-backup/ 中生成一个备份包,您可以根据需要再次hg unbundle

Use the strip command:

hg strip -r 2039

This command is provided by the StripExtension. It is distributed as part of Mercurial 2.8 and later, but you do need to enable it first by adding the following lines to your .hgrc or Mercurial.ini:

[extensions]
strip =

Before Mercurial 2.8, it was part of the MqExtension.

To prevent you from accidentally destroying history, the command will generate a backup bundle in .hg/strip-backup/ which you can hg unbundle again if desired.

情未る 2024-10-16 14:37:25

克隆本地存储库应该很快。我认为“几分钟”是指远程仓库?

您可以使用 hg clone; <新仓库> -r 仅克隆到某个版本。

Cloning your local repo should be fast. I assume "several minutes" refers to a remote repo?

You can use hg clone <local repo> <new repo> -r <revision> to only clone up to a certain revision.

薆情海 2024-10-16 14:37:25

要删除已提交并推送的变更集,请使用:

 hg backout -r (changeset number)

要删除已提交但未推送的变更集,请使用:

  hg strip -r (changeset number)

To remove a changeset that was already committed and pushed use :

 hg backout -r (changeset number)

To remove a changeset that was committed but not pushed use :

  hg strip -r (changeset number)
只为守护你 2024-10-16 14:37:25

对于 Mercurial 2.8 之前的版本,Strip 是 MqExtension 的一部分。
如果您需要启用旧的 MQ 扩展,
您可以通过添加以下内容来做到这一点:

[extensions]

hgext.mq =

到您的 ~/.hgrc (或mercurial.ini)文件中。

Strip 信息曾经位于此处,但现在可以此处

For versions previous to Mercurial 2.8, the Strip was part of the MqExtension.
In case you need to Enable the old MQ Extensions,
you can do it by adding this:

[extensions]

hgext.mq =

to your ~/.hgrc (or mercurial.ini) file.

The Strip information used to be here but now it can be found here.

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