How do I access Git User’s Manual[1] using the terminal?

Viewed 1176

In the man page of git, there is a line which says:

See gittutorial(7) to get started, then see giteveryday(7) for a useful minimum set of commands.
The Git User’s Manual[1] has a more in-depth introduction.

How do I see the "The Git User's Manual[1]" from the terminal it self, instead of looking it up on the internet.

6 Answers

The [1] part from Git User’s Manual[1] says it is a note.

Read until the end of the manual page (press the space bar to jump one page below) to go to the NOTES sections.

The first note is:

NOTES
    1. Git User’s Manual
       git-htmldocs/user-manual.html

git-htmldocs/user-manual.html is not a valid URL and it doesn't mean anything to me.

But the first section of man git (where you extracted the fragment you posted in the question) also says:

A formatted and hyperlinked copy of the latest Git documentation can be viewed at https://git.github.io/htmldocs/git.html.

At https://git.github.io/htmldocs/git.html there is the same documentation as HTML and the Git User's Manual link in this documentation points to: https://git.github.io/htmldocs/user-manual.html


You can also read the Git documentation on its website: https://git-scm.com/docs

For example, for the command, git clone <repo>, you can either use:

$ man git-clone

or:

$ git help clone

At the bottom of man git there are some reference links. The footnote number after "The Git User's Manual" should correspond to one of those links. On my machine I see

1. Git User’s Manual
   file:///usr/share/doc/git-doc/user-manual.html

So on my machine I can view /usr/share/doc/git-doc/user-manual.html. You can use a CLI browser like links to simplify reading the HTML:

links /usr/share/doc/git-doc/user-manual.html

Edit: On my machine that file doesn't actually exist, and I don't see an Arch Linux package providing it. Hopefully the Git documentation on your machine is complete.

If your documentation is also missing and you don't mind hitting the network you can browse the User's Manual from Git's website, e.g.:

links https://git-scm.com/docs/user-manual.html

The Git User's Manual is a part of git itself. It can be accessed by cloning the git repository hosted at kernel.org.

The file you are looking for is Documentation/user-manual.txt. To access it in the terminal, clone one of these:

git://git.kernel.org/pub/scm/git/git.git
https://git.kernel.org/pub/scm/git/git.git
https://kernel.googlesource.com/pub/scm/git/git.git

You can also clone just the docs without the rest of git from the git-htmldocs repository listed here. These include both the asciidoctor source and the rendered HTML.

Note that for browsing with just a web browser, the content is published here.

The git user manual may be downloaded in txt format, here is its location:

https://raw.githubusercontent.com/git/git/master/Documentation/user-manual.txt

It can be downloaded using wget or curl commands.

Then it can be read using less, or perhaps a combination of cat and grep

Example:

## read the first 150 lines of chapter 'Exploring Git history'
cat user-manual.txt | grep "Exploring Git history" -A 150

That answer is combination of already present ones plus explanation how to add file if it is not available locally.

When I run man git on my Linux, it has a phrase too:

The Git User’s Manual[1]

It looks like a footnote and indeed near the the end of man page I see:

    1. Git User’s Manual
       file:///usr/share/doc/git/html/user-manual.html

However the file is absent:

$ ls /usr/share/doc/git/html/user-manual.html
ls: cannot access '/usr/share/doc/git/html/user-manual.html': No such file or directory

I was not able to find package to add it via apt-get install (during the search I've found that Q&A). To add it I used:

git clone https://github.com/git/htmldocs.git

The file is user-manual.html in htmldocs folder, I copied it

sudo mkdir --parents /usr/share/doc/git/html
sudo cp htmldocs/user-manual.html /usr/share/doc/git/html

Then one open it via web browser, e.g. as suggested in another answer with:

links /usr/share/doc/git/html/user-manual.html

(after sudo apt-get install links as mainstream Linux distros do not have it installed by default).

Related