在实际提交之前检查将要提交的内容
我正在学习 Mercurial,尽管我安装了 TortoiseHG,但我发现自己越来越转向命令行。
我经常想在实际运行给定的 hg
命令之前检查它的结果是什么。是否有与我可以使用的 PowerShell 中已知的 -whatif
开关等效的东西,或者您将如何检查使用给定的 hg commit
语句将提交的内容?
I'm in the process of learning Mercurial, and even though I installed TortoiseHG, I find myself turning more and more to the command line.
So often I would like to check what the result of a given hg
command would be before I actually run it. Is there any equivalent to the -whatif
switch known from PowerShell I can use, or how would you go about checking what would be committed using a given hg commit
statement?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您提交时,您的消息编辑器将包含将在忽略部分中提交的文件列表。如果您使用
hg -m "message"
提交,这将不起作用,因为编辑器步骤被跳过:您可以使用
hg commit
和hg rollback
> 如果上次提交包含您不想提交的文件,则撤消上次提交。只要您没有hg Push
到另一个,回滚就会起作用存储库。状态的工作模式与提交相同。您可以使用
hg status some/path/*
,然后使用hg commit some/path/*
仅替换要使用的命令。When you do commit your message editor will contain a list of files that will be committed in the ignored section. If you commit with
hg -m "message"
this won't work as the editor step is skipped:You can use
hg commit
andhg rollback
to undo the last commit if it contained a file that you did not want to commit. The rollback works as long as you did nothg push
to another repository.Status works with the same patterns as commit. You can use
hg status some/path/*
and thenhg commit some/path/*
only replacing the command to use.通常,
-n
开关或--dry-run
开关会向您显示特定命令会发生什么。commit
没有-n
开关,但您可以运行hg diff
来查看实际更改,或hg status< /code> 查看每个文件的情况。
Often the
-n
switch or--dry-run
switch will show you what would have happened for a particular command.commit
doesn't have an-n
switch, but you could runhg diff
to see the actual changes, orhg status
to see what's going on with each file.