Команды Git

git help

git help: показать справку (англ. helpпомощь) по командам Git.

git help — это команда для доступа к встроенной документации Git. Она помогает изучать подкоманды, их опции и использование.

Если ты только начинаешь работать с Git или нужна быстрая справка по конкретной команде, git help — бесценный ресурс. С ней можно изучать возможности Git без необходимости искать документацию где-то ещё.

Примеры

Открыть руководство для конкретной команды Git

git help commit

Эта команда откроет руководство по git commit в стандартном текстовом просмотрщике или браузере в зависимости от настроек Git. В руководстве есть подробное описание команды, её опций и примеры использования.

Для навигации по странице руководства в терминале используй стрелки, клавиши Page Up и Page Down, а для выхода — q.

Результат:
NAME
       git-commit - Record changes to the repository
 
SYNOPSIS
       git commit [-a | --interactive | --patch] [-s] [-v] [-u<mode>] [--amend]
                  [--dry-run] [(-c | -C | --squash) <commit> | --fixup [(amend|reword):]<commit>)]
                  [-F <file> | -m <msg>] [--reset-author] [--allow-empty]
                  [--allow-empty-message] [--no-verify] [-e] [--author=<author>]
                  [--date=<date>] [--cleanup=<mode>] [--[no-]status]
                  [-i | -o] [--pathspec-from-file=<file> [--pathspec-file-nul]]
                  [(--trailer <token>[(=|:)<value>])...] [-S[<keyid>]]
                  [--] [<pathspec>...]
 
 
DESCRIPTION
       Create a new commit containing the current contents of the index and the given log message describing the changes. The new commit is a direct child of HEAD, usually the tip of the current branch, and the branch is updated to point
       to it (unless no branch is associated with the working tree, in which case HEAD is "detached" as described in git-checkout(1)).
 
       The content to be committed can be specified in several ways:
 
        1. by using git-add(1) to incrementally "add" changes to the index before using the commit command (Note: even modified files must be "added");
        ...

Показать все доступные команды Git

git help --all

Это выведет список всех команд Git, сгруппированных по категориям. После этого можно использовать git help <command>, чтобы узнать больше о конкретной команде.

Для навигации по списку в терминале используй стрелки, клавиши Page Up и Page Down, а для выхода — q.

Результат:
See 'git help <command>' to read about a specific subcommand
 
Main Porcelain Commands
add                     Add file contents to the index
am                      Apply a series of patches from a mailbox
archive                 Create an archive of files from a named tree
bisect                  Use binary search to find the commit that introduced a bug
branch                  List, create, or delete branches
bundle                  Move objects and refs by archive
checkout                Switch branches or restore working tree files
cherry-pick             Apply the changes introduced by some existing commits
citool                  Graphical alternative to git-commit
clean                   Remove untracked files from the working tree
clone                   Clone a repository into a new directory
...

Показать все руководства и туториалы Git

Помимо справки по конкретным командам, в Git есть встроенные руководства и туториалы:

git help -g

Это выведет список доступных руководств. Чтобы открыть нужное, используй git help guide-name (где guide-name — имя руководства из списка).

Результат:
The Git concept guides are:
core-tutorial    A Git core tutorial for developers
credentials      Providing usernames and passwords to Git
cvs-migration    Git for CVS users
diffcore         Tweaking diff output
everyday         A useful minimum set of commands for Everyday Git
faq              Frequently asked questions about using Git
glossary         A Git Glossary
namespaces       Git namespaces
remote-helpers   Helper programs to interact with remote repositories
submodules       Mounting one repository inside another
tutorial         A tutorial introduction to Git
tutorial-2       A tutorial introduction to Git: part two
workflows        An overview of recommended workflows with Git
...