--help, -h, help, man; Matter of knowing git helpers in terminal

Know more about git help commands in terminal and their differences

--help, -h, help, man; Matter of knowing git helpers in terminal
--help, -h, help, man; Matter of knowing git helpers in terminal

Sometimes we all need to remember the structure of a git command or its options. Depending on the situation, we get help from either google or terminal help commands. But we are often exposed to too much content and can get lost in tons of text just to find something simple in both google search results and terminal manpages.

To make this journey simple, it's better to know git help commands and their diffirances;

Git provides git help <verb> command to get descriptive and detailed help (manpage) about the target verb. for example git help push will prompt the manual page of the push command;

There are two other commands like git help to see the manual page, git <verb> --help and man git-<verb>.

Now you know that the results of these three commands are equal: man git-push = git help push = git push --help

But what if you only need a quick review of command options? You can use git <verb> -h in this case, like git push -h which will print out the related options and a brief description of each.

As a bonus for this short post, there is also a handy tool named tldr which provides a simplified version of manpages and contains examples rather than detailed explanations. You can install it by npm i -g tldr and use it like tldr git-push. BTW, tldr is not only for git commands but also for all commands available to man.

Enjoy :)

with and respects