是否有类似于git add -p
的Mercurial等效命令?
从man手册中引用,带有选项-p或--patch的git-add命令执行以下操作:
交互式选择索引和工作树之间的补丁块,并将它们添加到索引中。这会让用户有机会在将修改内容添加到索引之前查看差异。
是否有类似于git add -p
的Mercurial等效命令?
从man手册中引用,带有选项-p或--patch的git-add命令执行以下操作:
交互式选择索引和工作树之间的补丁块,并将它们添加到索引中。这会让用户有机会在将修改内容添加到索引之前查看差异。
hg record
命令将允许您逐个检查工作副本中的修改。您选择记录的任何更改都将被提交,而您选择不记录的更改则会保留在您的工作副本中作为修改。hg commit --interactive
命令。 - Baptiste Mille-Mathias记录扩展是这方面的标准工具。它允许您选择要包含或不包含在提交中的块。一旦在您的hgrc中启用了该扩展,命令就是:
hg record
CRecord Extension可以为您提供一个TUI(文本用户界面),让您能够选择要包含的行。但这不是标准功能,所以您需要将其下载到目录中,然后才能在hgrc中启用它。
hg crecord
编辑:
The Record extension is no longer necessary since approx v3.4. Now various commands support
the -i
or --interactive
flag. For example:
hg commit -i
...will ask you hunk by hunk what you want to include.
CRecord made it in to 3.8 as a core feature. Add the following to your
.hgrc
[ui]
interface = curses
Now, --interactive
commands will bring up the same interface as the old
CRecord extension.
从Mercurial 3.8.1版本开始,crecord扩展程序已经内置。请确保你的.hgrc
文件中的“ui”部分包含interface = curses
,否则会得到一个令人不舒服的问答界面。
[ui]
interface = curses
然后以交互方式提交您的提交,以便询问您要包含在该提交中的哪个补丁或哪一行。
hg commit --interactive