Windows命令提示符下的git help

the*_*ppo 9 windows git cmd windows-console

git helpWindows(msysgit发行版)上的命令每次运行时都会生成Web浏览器.我尝试了git help -m哪些报告"No manual entry for ...",哪些报告git help -i"info: Terminal type 'msys' is not smart enough to run Info."同样的情况发生在bash下面Cygwin.

cmd终端有没有明智的方法来获得轻量级的帮助?

Vit*_*kov 6

git <verb> -h在同一终端窗口中显示命令用法。

在另一方面,git <verb> --helpgit help <verb>打开浏览器。


tsu*_*sul 5

它适用于特定命令: git <command> -h

编辑,感谢@ the-happy-hippo

但它仅显示一个简要说明,不完整的一个,作为git help <command>git <command> --helpWindows上给出。

  • 知道 -h 为您提供了简短的帮助很有用。 (2认同)

Von*_*onC 2

Git 2.x 更新(2017 年 6 月,Git 2.13.1)

\n

你还没有男人:

\n
> git -c help.format=man help add\nwarning: failed to exec \'man\': No such file or directory\nfatal: no man viewer handled the request\n
Run Code Online (Sandbox Code Playgroud)\n

对于 也一样git <verb> --help
\ngit <verb> -h不打印手册页,只打印简短的用法部分(与 man 无关)

\n
\n

在 Git 2.34(2021 年第 4 季度)中,当git cmd -h显示多行使用文本(例如 cmd 子命令可能需要 sub-sub-command)时,parse-options API 学会了对齐这些行,甚至跨i18n / l10n也是如此。

\n

请参阅\xc3\x86var Arnfj\xc3\xb6r\xc3\xb0 Bjarmason ( )提交的提交 4631cfc(2021 年 9 月 21 日)、提交 84122ec提交 78a5091提交 5d70198(2021 年 9 月 13 日)。\n (由Junio C Hamano 合并 -- --提交 d7bc852中,2021 年 10 月 13 日)avar
gitster

\n
\n

parse-options:正确调整持续使用输出

\n

签署人:\xc3\x86var Arnfj\xc3\xb6r\xc3\xb0 Bjarmason

\n
\n
\n

某些命令(例如“ git stashman))会使用eg发出连续的选项输出git stash -h,因为usage_with_options_internal()带有自己的空格的前缀导致结果输出未正确对齐。
\n让我们考虑添加的空白,它可以正确对齐输出。

\n

git stash”命令具有带有 N_() 转换的用法输出,该转换合法地跨多行延伸;

\n
N_("git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\\n"\n   "          [-u|--include-untracked] [-a|--all] [-m|--message <message>]\\n"\n[...]\n
Run Code Online (Sandbox Code Playgroud)\n

我们希望该输出与初始“ git stash”输出的长度对齐,但由于usage_with_options_internal()添加了自己的空格前缀,我们未能达到要求,在此更改之前我们会发出:

\n
$ git stash -h\nusage: git stash list [<options>]\n   or: git stash show [<options>] [<stash>]\n   [...]\n   or: git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n          [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n          [...]\n
Run Code Online (Sandbox Code Playgroud)\n

现在我们将正确发出对齐的输出。
\n即
\n上面的最后四行将改为(仅对上面的空格进行更改):

\n
[...]\nor: git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]\n              [-u|--include-untracked] [-a|--all] [-m|--message <message>]\n              [...]\n
Run Code Online (Sandbox Code Playgroud)\n

此更改相对更复杂,因为我已考虑使其能够面向未来的 RTL 翻译支持。
\n稍后usage_with_options_internal()我们有一些可追溯到d7a38c5的现有填充代码(“ parse-options:能够自动生成用法”,2007-10-15,Git v1.5.4-rc0 -- merge),它不是 RTL 安全的,但是该代码很容易修复。
\n我们不要在这里引入新的 RTL 翻译问题。

\n
\n
\n

原始答案(2014)

\n

不,尽管“如何让 git 在 Windows 中显示命令行帮助? ”中建议了基于 htlp txt 文件的“cat”的替代方案。

\n

man.<tool>.cmd2008 年引入的配置允许设置自定义命令,但 msys shell 不随man.exe.

\n