2011-04-01 78 views
19

如何讓git在Windows中顯示命令行幫助?我如何讓git在Windows中顯示命令行幫助?

我使用的是msysgit 1.7.4。

它默認打開瀏覽器中的html幫助。

我只想在控制檯上顯示文本幫助。

我見過配置help.format(默認設置爲html)。我試圖將其設置爲手冊或信息,但它只是說:

fatal: no info viewer handled the request 

感謝, 亞光

回答

8

Issue 187issue 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 <verb> -h不打印手冊頁,只有簡短的用法部分(與man無關)

+2

哇,真的很不幸。這是我學會使用它的主要方式! – Cascabel 2011-04-01 19:35:53

+1

你也可以嘗試自己安裝'man',看這個超級用戶帖子:http://superuser.com/questions/295398/man-pages-for-git-bash-on-windows-7#comment919391_634889 – jamiebarrow 2015-10-29 11:25:48

+0

問題187鏈接不再工作 - 但在github回購中有[類似報道](https://github.com/git-for-windows/git/issues/696)。 – Zitrax 2016-03-31 07:04:48

5

我剛剛花了一些時間研究這個問題,這些是我的結論:

  • msysgit附帶.html和.txt文檔,後者非常適合在控制檯上閱讀;但是,不存在直接顯示txt的選項。 help.format只支持web/man/info

  • 爲此無法哄騙'web'格式 - 我嘗試將.txt文件重命名爲.html,並將我的git web.browser設置爲more(together與browser.more.cmd),只發現Git的窗口實現忽略這些設置並直接啓動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) 

多一點打字這種方式,而是一種實用的解決方案。

+0

在Windows上沒有控制檯輸出仍然有點麻煩,但這總比沒有好。 – legalize 2014-02-02 19:03:45

+0

不幸的是,最近安裝的Git中沒有.txt文檔。只有.html。 – tsul 2017-06-22 12:32:35

1

使用git <command> -h而不是--helphelp。它適用於Git for Windows的所有最新版本,但僅提供簡短的用法,而不是完整的描述。

相關問題