Команди Git

git help

git help — команда для доступу до вбудованої документації Git. Це зручний спосіб дізнатися про різні команди 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
...