【问题标题】:how do i get git to show command-line help in windows?如何让 git 在 Windows 中显示命令行帮助?
【发布时间】:2011-07-27 21:59:44
【问题描述】:

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

我正在使用 msysgit 1.7.4。

浏览器默认打开html帮助

我只想在控制台上显示文本帮助。

我已经看到了配置 help.format(默认设置为 html)。我尝试将其设置为 man 或 info,但它只是说:

fatal: no info viewer handled the request

谢谢, 马特

【问题讨论】:

    标签: git msysgit


    【解决方案1】:

    使用git <command> -h 代替--helphelp。它适用于所有最新版本的 Git for Windows,但仅提供简短用法,而不是完整说明。

    【讨论】:

      【解决方案2】:

      Issue 187 issue 696 确实报告了:

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

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

      作为jamiebarrow 添加in the comments

      你也可以试试installing man yourself

      MinGW-get install msys-man. 
      

      man 也是available as a windows binary:(通过mingw FAQ 找到)。该页面还有groff


      如“Getting Started - Getting Help”中所述,这三个命令调用手册页,但仅在其 HTML 版本中:

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

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

      【讨论】:

      • 哇,这真的有点不幸。这是我学会使用它的主要方式!
      • 您也可以尝试自己安装man,请参阅此超级用户帖子:superuser.com/questions/295398/…
      • 问题 187 链接不再起作用 - 但 github 存储库中有 similar report
      • @Zitrax 谢谢。我已经相应地编辑了答案
      【解决方案3】:

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

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

      • 没有办法为此目的哄骗“网络”格式 - 我尝试将 .txt 文件重命名为 .html 并将我的 git web.browser 设置为更多(连同 browser.more.cmd),只有发现Git的windows实现忽略了这些设置,直接启动html文件(即在默认浏览器中):http://comments.gmane.org/gmane.comp.version-control.msysgit/10798

      • 除非你想安装和使用 cygwin,否则使用 man 或 info 也没有简单的方法 - 你需要下载可执行文件的一个端口,连同它的依赖项(groff 等),配置它,并手动下载手册页

      最后我解决了最简单的方法:

      githelp.bat: @more "C:\Program Files\Git\doc\git\html\%1.txt"

      githelpfind.bat: @dir /b "C:\Program Files\Git\doc\git\html\*.txt" |找到“%1”

      用法:

      \> githelpfind prune
      git-prune-packed.txt
      git-prune.txt
      
      \> githelp git-prune
      (blah blah blah)
      

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

      【讨论】:

      • 在 Windows 上没有控制台输出仍然有点 sux,但这总比没有好。
      • 不幸的是,最近的 Git for Windows 安装中没有 .txt 文档。只有 .html。
      • 山猫总是有的。经过一些实验,我选择了 Lynx 的最新稳定俚语版本 - 转到 here 并选择稳定版本/俚语。我需要将C:\Program Files (x86)\Lynx - web browser 添加到我的路径并执行git config --global web.browser lynx。这可能会满足我的需求 - 如果它适用于其他人,我会重新发布这个作为答案。
      猜你喜欢
      • 1970-01-01
      • 2016-04-06
      • 2020-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-20
      相关资源
      最近更新 更多