30

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

4 Answers 4

20

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.

Sign up to request clarification or add additional context in comments.

Comments

13

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)

4 Comments

Wow, that's really kind of unfortunate. That's the main way I learned to use it!
You could also try installing man yourself, see this SuperUser post: superuser.com/questions/295398/…
The issue 187 link does not work anymore - but there is similar report in the github repo.
@Zitrax Thank you. I have edited the answer accordingly
5

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.

3 Comments

That there is no console output on Windows still kinda sux, but this is better than nothing.
Unfortunately, there are no .txt docs in the recent Git for Windows installations. Only .html.
There's always Lynx. After some experimentation, I went with the latest stable slang version of Lynx - go here and pick Stable release/slang. I needed to add C:\Program Files (x86)\Lynx - web browser to my path and execute git config --global web.browser lynx. This will probably satisfy my needs - if it works for anyone else, I'll re-post this as an answer.
0

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! ;)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.