【问题标题】:Make Mercurial not to commit anything, unless the filenames are explicitly specified使 Mercurial 不提交任何内容,除非明确指定文件名
【发布时间】:2011-11-10 11:08:35
【问题描述】:

根据 Mercurial 的提交帮助信息:

If a list of files is omitted, all changes reported by "hg status" will be
committed.

有没有一种简单的方法可以改变这种行为?

我希望 Mercurial 不提交任何更改,除非明确指定文件。

编辑

我在 Linux 上,我正在使用命令行。

【问题讨论】:

    标签: mercurial commit


    【解决方案1】:

    这似乎可以解决问题:

    $ hg commit -X *  
    nothing changed
    

    它不会做任何事情,因为所有文件都被排除在外,但是如果您提供任何文件,这些文件将被包含在内。

    你可以给它取别名:

    [别名]
    xcommit = 提交 -X *

    然后:

    $ hg status
    M a
    M b
    $ hg xcommit -m 'no files specified'
    nothing changed
    $ hg xcommit -m 'picking a' a
    $ hg status
    M b
    

    就我个人而言,我不想习惯这种类型的工作流程。通常也很容易:

    • 以较小的块工作,以便您的更改反映单个变更集
    • 当您忘记并且正在疯狂编码时,请使用 hg record 之类的东西
    • 对于上述两个不适合的极少数情况,请使用 -I/-X 进行单次提交

    【讨论】:

    • 谢谢。这就是我一直在寻找的。也感谢您的提示。
    • 即使这不是 OP 的动机,+1 占卜技能,而不仅仅是命令行 :)
    【解决方案2】:

    如果你使用的是像 tortoiseHg 这样的 GUI,你可以选择你需要提交的文件。 http://tortoisehg.bitbucket.io/

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-20
    • 2013-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-05
    • 1970-01-01
    • 2019-12-25
    相关资源
    最近更新 更多