git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Why are there multiple ways to get the manual in Git?
@ 2016-09-17 17:47 Andrew Johnson
  2016-09-17 18:39 ` Fredrik Gustafsson
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Johnson @ 2016-09-17 17:47 UTC (permalink / raw)
  To: git

Hi,

I was curious as to why the developers of Git decided to have three
methods to get the manual for a verb. I am a developer who strives to
understand Git to its fullest extent, and will share any information
given on this question.

While reading Pro Git 2nd Ed. I came across these three methods:

$ git help <verb>
$ git <verb> --help
$ man git-<verb>

I tested all three to confirm they were equivalent.

What was the motivation behind the complication, if any? I presume
most developers would not provide multiple commands that do the same
thing for absolutely no reason, so I led myself to ask this question.

Respectfully,
Andrew Johnson

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why are there multiple ways to get the manual in Git?
  2016-09-17 17:47 Why are there multiple ways to get the manual in Git? Andrew Johnson
@ 2016-09-17 18:39 ` Fredrik Gustafsson
  2016-09-17 19:12   ` Philip Oakley
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Fredrik Gustafsson @ 2016-09-17 18:39 UTC (permalink / raw)
  To: Andrew Johnson; +Cc: git

On Sat, Sep 17, 2016 at 01:47:52PM -0400, Andrew Johnson wrote:
> $ git help <verb>
> $ git <verb> --help
> $ man git-<verb>
> 
> I tested all three to confirm they were equivalent.

While I'm not able to answer your question, I can shred a little light
about them not being equal. For example using a windows machine

$ man git <verb>

does not work and

$ git help <verb>

opens a webbrowser instead of a man page. Using a unix system I would
however assume that

$ man git <verb>

would work since it's the standard way of getting help on those systems.

-- 
Fredrik Gustafsson

phone: +46 733-608274
e-mail: iveqy@iveqy.com
website: http://www.iveqy.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why are there multiple ways to get the manual in Git?
  2016-09-17 18:39 ` Fredrik Gustafsson
@ 2016-09-17 19:12   ` Philip Oakley
  2016-09-17 19:21   ` Christian Couder
  2016-09-18 10:21   ` Jakub Narębski
  2 siblings, 0 replies; 8+ messages in thread
From: Philip Oakley @ 2016-09-17 19:12 UTC (permalink / raw)
  To: Fredrik Gustafsson, Andrew Johnson; +Cc: git

From: "Fredrik Gustafsson" <iveqy@iveqy.com>
> On Sat, Sep 17, 2016 at 01:47:52PM -0400, Andrew Johnson wrote:
>> $ git help <verb>
>> $ git <verb> --help
>> $ man git-<verb>
>>
>> I tested all three to confirm they were equivalent.

It is (IIUC) in a general sort of way "by design", and a little bit of 
accident.

>
> While I'm not able to answer your question, I can shred a little light
> about them not being equal. For example using a windows machine
>
> $ man git <verb>
>
> does not work and
>
> $ git help <verb>
>
> opens a webbrowser instead of a man page. Using a unix system I would
> however assume that
>
> $ man git <verb>
>
> would work since it's the standard way of getting help on those systems.
>
> -- 

Historically git was a set of shell scripts named git-*, so each stood 
alone.

Then there was the great consolidation (around V1.6?) which created the 
modern `git <cmd>' approach, with every command normally having  -h 
and --help options for short form usage and long form man pages.

The option capability became standardised. Also a `git help <cmd>` command 
was created. Underneath there are still the (backward compatible) git-* 
forms. The help command allowed selection of display type, so that on 
Unix/Linux man was the norm, while an --html (or --web) option is available 
for those who like the pretty browser view

The help commnad just converts the parameters to achieve the expected 
display (with various fallbacks if the command or guide is missing, etc)

Meanwhile on Windows, the man facility was not ported as part of git, so it 
defaults to the --web version. If you are on Windows, and download the SDK 
as well you can install the man viewer and other goodies

--
Philip


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why are there multiple ways to get the manual in Git?
  2016-09-17 18:39 ` Fredrik Gustafsson
  2016-09-17 19:12   ` Philip Oakley
@ 2016-09-17 19:21   ` Christian Couder
  2016-09-18 10:21   ` Jakub Narębski
  2 siblings, 0 replies; 8+ messages in thread
From: Christian Couder @ 2016-09-17 19:21 UTC (permalink / raw)
  To: Fredrik Gustafsson; +Cc: Andrew Johnson, git

On Sat, Sep 17, 2016 at 8:39 PM, Fredrik Gustafsson <iveqy@iveqy.com> wrote:
> On Sat, Sep 17, 2016 at 01:47:52PM -0400, Andrew Johnson wrote:
>> $ git help <verb>
>> $ git <verb> --help
>> $ man git-<verb>
>>
>> I tested all three to confirm they were equivalent.

Maybe it will be easier to understand if you try:

$ git help help

or

$ git help --help

or

$ man git-help

:-)

> While I'm not able to answer your question, I can shred a little light
> about them not being equal. For example using a windows machine
>
> $ man git <verb>

(It should be "git-<verb>" above.)

> does not work and
>
> $ git help <verb>
>
> opens a webbrowser instead of a man page.

Yeah, it is one of the reasons.
There are systems where "man" is not the standard ways to get help,
and text on the command line is not the prefered format for help
content.
So the "git help" command has different default depending on the OS to
better suit user expectations on each OS.
This way people can just be teached to use "git help" and that will do
something sensible everywhere.

> Using a unix system I would
> however assume that
>
> $ man git <verb>

(Again it should be "git-<verb>" above.)

> would work since it's the standard way of getting help on those systems.

Yeah, so we need that to work to make people happy on unix systems.

Another reason is that "git help" provides more configurability and
more features like its -a and -g options.
It could provide even more in the future, like options to search in
the documentation.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why are there multiple ways to get the manual in Git?
  2016-09-17 18:39 ` Fredrik Gustafsson
  2016-09-17 19:12   ` Philip Oakley
  2016-09-17 19:21   ` Christian Couder
@ 2016-09-18 10:21   ` Jakub Narębski
  2016-09-18 10:51     ` Philip Oakley
  2 siblings, 1 reply; 8+ messages in thread
From: Jakub Narębski @ 2016-09-18 10:21 UTC (permalink / raw)
  To: Fredrik Gustafsson, Andrew Johnson; +Cc: git, Christian Couder, Philip Oakley

W dniu 17.09.2016 o 20:39, Fredrik Gustafsson pisze:
> On Sat, Sep 17, 2016 at 01:47:52PM -0400, Andrew Johnson wrote:

>> $ git help <verb>
>> $ git <verb> --help
>> $ man git-<verb>
>>
>> I tested all three to confirm they were equivalent.
> 
> While I'm not able to answer your question, I can shred a little light
> about them not being equal. For example using a windows machine
> 
> $ man git-<verb>
> 
> does not work and
> 
> $ git help <verb>
> 
> opens a webbrowser instead of a man page. Using a unix system I would
> however assume that
> 
> $ man git-<verb>
> 
> would work since it's the standard way of getting help on those systems.

There is also additional difference.  There are help pages which are
not about specific Git command, but about concepts (gitcli, gitrevisions,
githooks, gitrepository-layout, gitglossary), or about files (gitignore,
gitattributes, to some extent githooks).

Those are only accessible with `git help <concept>` or, on OS with
installed 'man', also `man <gitconcept>`.

Just FYI
-- 
Jakub Narębski

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why are there multiple ways to get the manual in Git?
  2016-09-18 10:21   ` Jakub Narębski
@ 2016-09-18 10:51     ` Philip Oakley
  2016-09-19 15:59       ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Philip Oakley @ 2016-09-18 10:51 UTC (permalink / raw)
  To: Fredrik Gustafsson, Andrew Johnson, Jakub Narębski
  Cc: git, Christian Couder

From: "Jakub Narębski" <jnareb@gmail.com>
>W dniu 17.09.2016 o 20:39, Fredrik Gustafsson pisze:
>> On Sat, Sep 17, 2016 at 01:47:52PM -0400, Andrew Johnson wrote:
>
>>> $ git help <verb>
>>> $ git <verb> --help
>>> $ man git-<verb>
>>>
>>> I tested all three to confirm they were equivalent.
>>
>> While I'm not able to answer your question, I can shred a little light
>> about them not being equal. For example using a windows machine
>>
>> $ man git-<verb>
>>
>> does not work and
>>
>> $ git help <verb>
>>
>> opens a webbrowser instead of a man page. Using a unix system I would
>> however assume that
>>
>> $ man git-<verb>
>>
>> would work since it's the standard way of getting help on those systems.
>
> There is also additional difference.  There are help pages which are
> not about specific Git command, but about concepts (gitcli, gitrevisions,
> githooks, gitrepository-layout, gitglossary), or about files (gitignore,
> gitattributes, to some extent githooks).
>
> Those are only accessible with `git help <concept>` or, on OS with
> installed 'man', also `man <gitconcept>`.

The `git revisions --help` does work ;-) But like you say, its apparent 
"command" name is 'gitrevisions'.

Thus real commands gave a git-command name, while concepts have a gitconcept 
name which can then be found via the man command.

--
Philip 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why are there multiple ways to get the manual in Git?
  2016-09-18 10:51     ` Philip Oakley
@ 2016-09-19 15:59       ` Junio C Hamano
  2016-09-19 16:22         ` Philip Oakley
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2016-09-19 15:59 UTC (permalink / raw)
  To: Philip Oakley
  Cc: Fredrik Gustafsson, Andrew Johnson, Jakub Narębski, git,
	Christian Couder

"Philip Oakley" <philipoakley@iee.org> writes:

> The `git revisions --help` does work ;-)

Not anymore ;-)

I think Ralf Thielow fixed it recently.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Why are there multiple ways to get the manual in Git?
  2016-09-19 15:59       ` Junio C Hamano
@ 2016-09-19 16:22         ` Philip Oakley
  0 siblings, 0 replies; 8+ messages in thread
From: Philip Oakley @ 2016-09-19 16:22 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Fredrik Gustafsson, Andrew Johnson, Jakub Narebski, git,
	Christian Couder

From: "Junio C Hamano" <gitster@pobox.com>
> "Philip Oakley" <philipoakley@iee.org> writes:
> 
>> The `git revisions --help` does work ;-)
> 
> Not anymore ;-)
> 
> I think Ralf Thielow fixed it recently.

hmm, I sort of though it would still work with a valid guide.

I'd only checked with my last GfW version.
--
hey ho
Philip

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-19 16:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-17 17:47 Why are there multiple ways to get the manual in Git? Andrew Johnson
2016-09-17 18:39 ` Fredrik Gustafsson
2016-09-17 19:12   ` Philip Oakley
2016-09-17 19:21   ` Christian Couder
2016-09-18 10:21   ` Jakub Narębski
2016-09-18 10:51     ` Philip Oakley
2016-09-19 15:59       ` Junio C Hamano
2016-09-19 16:22         ` Philip Oakley

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).