在实际提交之前检查将要提交的内容

发布于 2024-08-23 00:27:13 字数 210 浏览 9 评论 0原文

我正在学习 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

偏爱自由 2024-08-30 00:27:13

当您提交时,您的消息编辑器将包含将在忽略部分中提交的文件列表。如果您使用 hg -m "message" 提交,这将不起作用,因为编辑器步骤被跳过:

HG: Enter commit message.  Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: User <[email protected]>
HG: branch 'default'
HG: changed myfile.yxy

您可以使用 hg commithg 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:

HG: Enter commit message.  Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: User <[email protected]>
HG: branch 'default'
HG: changed myfile.yxy

You can use hg commit and hg 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 not hg push to another repository.

Status works with the same patterns as commit. You can use hg status some/path/* and then hg commit some/path/* only replacing the command to use.

年少掌心 2024-08-30 00:27:13

通常,-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 run hg diff to see the actual changes, or hg status to see what's going on with each file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文