4

I want to do git log --help but I don't want the annoying "browser" to pop up. I just want the syntax listing right within Bash. Like when i type git -?, I get:

Unknown option: -? usage: git [--version] [--help] [-C <path>] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

but when I type git log -?, I get:

fatal: unrecognized argument: -?

The moment I use the --help parameter, it spawns my web browser. I just want the syntax spec listed right within Bash. Is there any way to achieve this?

Personally, I find the inline Bash help listings easier to read and comprehend than the web based help.

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
JaedenRuiner
  • 329
  • 4
  • 18
  • it seems an uncommon behavior. you can try `man git log` – xaa Feb 02 '16 at 17:23
  • @xaa I believe there needs to be a dash between `git` and `log`, otherwise `man` is going to first open the `git` man page, and then the help for `builtin`, because apparently `man log` brings up the help for `logout`, which falls back to the `builtin`s help. – Siguza Feb 02 '16 at 17:28
  • What platform is this ? It sounds like you are using Git with bash on Windows in Msys or a similar distribution. – SirDarius Feb 02 '16 at 17:29
  • 3
    Do you have the `help.format` global setting set to `web`? You can check with `git config -l`. If it is `web`, you might want to change it to `man`, see [git help documentation](https://git-scm.com/docs/git-help). – Benjamin W. Feb 02 '16 at 17:32
  • yes i am using msys (mingw64) on windows. and current help.format is set to html. – JaedenRuiner Sep 20 '17 at 19:43

2 Answers2

2

The git setting help.format needs to be set to something else than html, but your environment needs to support the alternatives.

You can try without changing the config by adding a parameter:

git log --help --man uses the man tool, if present.

See git help in Windows command prompt for Windows CMD, for example.

Andy
  • 4,783
  • 2
  • 26
  • 51
0

If you want to just to print the output to the standard output instead of spawning a viewer, you can use:

git log --help | cat

You could also try less, that brings some added features:

git log --help | less
user000001
  • 32,226
  • 12
  • 81
  • 108