git help in Windows command prompt

后端 未结 4 1514
失恋的感觉
失恋的感觉 2021-02-19 19:13

The git help command on Windows (msysgit distribution) spawns web browser each time I run it. I tried git help -m which reports \"No

相关标签:
4条回答
  • 2021-02-19 19:26

    It works for particular commands: git <command> -h

    Edit, thanks to @the-happy-hippo

    But it shows only a brief description, not the full one, as git help <command> or git <command> --help gives on Windows.

    0 讨论(0)
  • 2021-02-19 19:38

    World's most overengineered workaround for this problem: use WSL

    (that is, unless you already are a WSL user, in which case it's merely an ordinary workaround)

    1. Install one of the linux distros via Windows Store
    2. Go in and ensure it has the git package installed
    3. From the Windows command line, bash -c 'git help fetch' etc.

    Here's an alias for that last one:

    [alias]
        hep = "!f() { $SYSTEMROOT/System32/bash -c \"git help $1\"; }; f"
    

    (And no you can't override git built-ins, but you can make a shell command to intercept and reroute help.)

    0 讨论(0)
  • 2021-02-19 19:42

    Update for Git 2.x (June 2017, Git 2.13.1)

    You still don't have man:

    > git -c help.format=man help add
    warning: failed to exec 'man': No such file or directory
    fatal: no man viewer handled the request
    

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


    No, even though an alternative, based on a 'cat' of the htlp txt files, is suggested in "how do I get git to show command-line help in windows?".

    There man.<tool>.cmd config introduced in 2008, allows to set a custom command, but msys shell isn't shipped with man.exe.

    0 讨论(0)
  • 2021-02-19 19:45

    git <verb> -h shows a command usage in the same terminal window.

    On the other hand, git <verb> --help and git help <verb> open a browser.

    0 讨论(0)
提交回复
热议问题