如何让 git 在 Windows 中显示命令行帮助?

发布于 2024-10-29 02:07:25 字数 264 浏览 3 评论 0原文

如何让 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 技术交流群。

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

发布评论

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

评论(4

夜雨飘雪 2024-11-05 02:07:25

使用 git <命令> -h 而不是 --helphelp。它适用于 Windows 版 Git 的所有最新版本,但仅提供简短的用法,而不提供完整的描述。

Use git <command> -h instead of --help or help. It works in all recent versions of Git for Windows, but gives only the short usage, not the full description.

青衫负雪 2024-11-05 02:07:25

问题 187 问题 696 确实报告:

主要问题是我们既不提供 man.exe 也不提供手册页
否则,您可以在 /etc/gitconfig 中将 help.format 设置为“man”。

所以现在,这是不可能的......

正如 jamiebarrow 添加 在评论中

您也可以尝试自己安装 man

MinGW-get install msys-man. 

man 也可以作为 Windows 二进制文件提供:(通过 mingw 常见问题解答找到)。该页面还有 groff


如“入门 - 获取帮助”中所述,这三个命令调用手册页,但仅限于 HTML 版本:

$ git help <verb>
$ git <verb> --help
$ man git-<verb>

git; -h 不打印手册页,只打印简短的用法部分(与 man 无关)

Issue 187 issue 696 does report:

The main problem is that we do ship neither man.exe nor the man pages.
Otherwise, you could set help.format to 'man' in /etc/gitconfig.

So right now, this isn't possible...

As jamiebarrow adds in the comments:

You could also try installing man yourself

MinGW-get install msys-man. 

man is also available as a windows binary: (found via the mingw FAQ). That page also has groff.


As mentioned in "Getting Started - Getting Help", those three commands invokes the man page, but only in its HTML version:

$ git help <verb>
$ git <verb> --help
$ man git-<verb>

git <verb> -h does not print the man page, only the short usage section (nothing to do with man)

北音执念 2024-11-05 02:07:25

我刚刚花了一些时间研究这个主题,这些是我的结论:

  • msysgit 附带 .html 和 .txt 文档,后者非常适合在控制台上阅读;但是,不存在直接显示 txt 的选项。 help.format 仅支持 web/man/info

  • 没有办法为此目的哄骗“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"

用法:用

\> githelpfind prune
git-prune-packed.txt
git-prune.txt

\> githelp git-prune
(blah blah blah)

这种方式输入更多内容,但这是一个实用的解决方案。

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:

\> githelpfind prune
git-prune-packed.txt
git-prune.txt

\> githelp git-prune
(blah blah blah)

A little more typing this way, but a functional solution.

多情出卖 2024-11-05 02:07:25

我刚刚在网上研究了一下,发现除非你想安装和使用cygwin,否则没有简单的方法来使用man。

因此,如果您急于解决错误,我建议您仅使用 git
您应该能够看到在各种情况下使用的常见 Git 命令。

git help -agit help -g 列出了可用的子命令和一些概念指南。请参阅 git helpgit 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 and git help -g list available subcommands and some concept guides. See git help <command> or git help <concept> to read about a specific subcommand or concept. See git help git for an overview of the system.

I hope this helps you! ;)

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