Michael Michael - 5 months ago 27
Git Question

In git, how do I display the usage overview that I get when I use a command incorrectly, without actually using a command incorrectly?

If I use a git command incorrectly, like

git commit -b

I get useful usage output on the terminal like so:

error: unknown switch `b'
usage: git commit [<options>] [--] <pathspec>...

-q, --quiet suppress summary after successful commit
-v, --verbose show diff in commit message template



How do I get this information to show up without entering an incorrect command? I've tried
git help commit
, but that opens a webpage.
git help -w commit
does the same, while
git help -m commit
git help -i commit
don't work at all (on Git Bash for Windows; they do bring up man or info pages on Linux though.)

I can't just "enter an incorrect command" because I don't know beforehand if a command is wrong or not, and I don't want to accidentally destroy my work by entering a command that happens to do something terrible (hmm, I wonder how I can use push better. Let's bring up the usage with some junk command, how about git push -f).

Answer Source

Use the -h switch.

Using --help shows the man page, which can obviously also be accessed using man git commit.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download