【问题标题】:What is the Mercurial(hg) equivalent of git stash?git stash 的 Mercurial(hg) 等价物是什么?
【发布时间】:2021-11-24 13:16:50
【问题描述】:

在 hg 中,git stashgit stash applygit stash pop 的等效命令是什么?

【问题讨论】:

标签: git mercurial


【解决方案1】:

暂时搁置您的更改:

水银 首选hg commit [-s] 不推荐hg shelve

Git git stash

列表更改被搁置

Mercurial hg xlhg shelve -l

Git git stash list

查看上架的更改

水银 hg diff -c <rev>hg shelve -p <name>

Git git stash show <name>

恢复上架的更改

水银 hg uncommit --no-keephg unshelve

Git git stash pop

恢复上架的更改,但将它们保留在堆栈中

水银 继续修改或 hg uncommit --keephg unshelve --keep

Git git stash apply

【讨论】:

  • 我经常用hg shelve,为什么说不推荐呢?
【解决方案2】:

我为此使用 mq 扩展(默认情况下未启用)。这个扩展让我有可能拥有一组(尚未完成的)补丁,我保持在“官方”历史之上。

您将使用 git stash 执行的操作现在是 hg qnew »patchname« && hg qpopgit stash pop 现在变为 hg qpush。最大的直接显着差异是,您必须在 mercurial 中为您的补丁命名,而 git 变体很乐意匿名生活。

Steve Losh 做了更多 in depth article 这个扩展也可以做的事情。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-16
    • 1970-01-01
    • 1970-01-01
    • 2011-11-29
    • 1970-01-01
    • 2021-08-26
    • 1970-01-01
    • 2017-05-30
    相关资源
    最近更新 更多