【发布时间】: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 的提交帮助信息:
If a list of files is omitted, all changes reported by "hg status" will be committed.
有没有一种简单的方法可以改变这种行为?
我希望 Mercurial 不提交任何更改,除非明确指定文件。
我在 Linux 上,我正在使用命令行。
【问题讨论】:
这似乎可以解决问题:
$ 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 进行单次提交【讨论】:
如果你使用的是像 tortoiseHg 这样的 GUI,你可以选择你需要提交的文件。 http://tortoisehg.bitbucket.io/
【讨论】: