如何让 git 在 Windows 中显示命令行帮助?
如何让 git 在 Windows 中显示命令行帮助?
我正在使用 msysgit 1.7.4。
默认在浏览器中打开html帮助。
我只想在控制台上显示文本帮助。
我已经看到了配置 help.format (默认设置为 html)。我尝试将其设置为 man 或 info,但它只是说:
fatal: no info viewer handled the request
谢谢, 马特
How do i get git to show command-line help in windows?
I'm using msysgit 1.7.4.
It's defaulting to open the html help in the browser.
I just want to show the text help on the console.
I've seen the config help.format (which is set to html by default). I tried setting this to man or info, but it just says that:
fatal: no info viewer handled the request
Thanks,
matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用 git <命令> -h 而不是
--help
或help
。它适用于 Windows 版 Git 的所有最新版本,但仅提供简短的用法,而不提供完整的描述。Use
git <command> -h
instead of--help
orhelp
. It works in all recent versions of Git for Windows, but gives only the short usage, not the full description.问题 187问题 696 确实报告:所以现在,这是不可能的......
正如 jamiebarrow 添加 在评论中:
如“入门 - 获取帮助”中所述,这三个命令调用手册页,但仅限于 HTML 版本:
git; -h
不打印手册页,只打印简短的用法部分(与man
无关)Issue 187issue 696 does report:So right now, this isn't possible...
As jamiebarrow adds in the comments:
As mentioned in "Getting Started - Getting Help", those three commands invokes the man page, but only in its HTML version:
git <verb> -h
does not print the man page, only the short usage section (nothing to do withman
)我刚刚花了一些时间研究这个主题,这些是我的结论:
没有办法为此目的哄骗“web”格式 - 我尝试将 .txt 文件重命名为 .html 并将我的 git web.browser 设置为 more (与浏览器一起) .more.cmd),却发现 Git 的 Windows 实现忽略了这些设置并直接启动 html 文件(即在默认浏览器中): http://comments.gmane.org/gmane.comp.version-control.msysgit/10798
除非您想安装和使用 cygwin,否则也没有简单的方法来使用 man 或 info - 您需要下载可执行文件的端口,以及 除非您想安装和
最后我解决了最简单的方法:
githelp.bat:
@more“C:\ Program Files \ Git \ doc \ git \ html \%1.txt”
githelpfind.bat:
@dir /b "C:\Program Files\Git\doc\git\html\*.txt" | find "%1"
用法:用
这种方式输入更多内容,但这是一个实用的解决方案。
I've just spent some time researching the subject, and these are my conclusions:
msysgit ships with .html and .txt documentation, the latter being well suited for reading on the console; however, no option for directly displaying the txt exists. help.format only supports web/man/info
there's no way to coax the 'web' format for that purpose - I tried renaming the .txt files to .html and setting my git web.browser to more (together with browser.more.cmd), only to find out that the windows implementation of Git ignores these settings and launches the html file directly (i.e. in the default browser): http://comments.gmane.org/gmane.comp.version-control.msysgit/10798
unless you want to install and use cygwin, there's no easy way to use man or info either - you'll need to download a port of the executable, together with its dependencies (groff, etc), configure it, and download the manpages manually
In the end I resolved for the simplest approach:
githelp.bat:
@more "C:\Program Files\Git\doc\git\html\%1.txt"
githelpfind.bat:
@dir /b "C:\Program Files\Git\doc\git\html\*.txt" | find "%1"
Usage:
A little more typing this way, but a functional solution.
我刚刚在网上研究了一下,发现除非你想安装和使用cygwin,否则没有简单的方法来使用man。
因此,如果您急于解决错误,我建议您仅使用
git
。您应该能够看到在各种情况下使用的常见 Git 命令。
git help -a
和git help -g
列出了可用的子命令和一些概念指南。请参阅git help
或git help
了解特定子命令或概念。请参阅git help git
了解系统概述。我希望这对您有帮助! ;)
I just have been researching online and found out that, unless you want to install and use cygwin, there's no easy way to use man.
So if you are in a bit hurry to resolve your error, I would recommend you to just use
git
.You should be able to see the common Git Commands used in various situations.
git help -a
andgit help -g
list available subcommands and some concept guides. Seegit help <command>
orgit help <concept>
to read about a specific subcommand or concept. Seegit help git
for an overview of the system.I hope this helps you! ;)