text
This commit is contained in:
		@@ -6,6 +6,9 @@ monofontoptions:
 | 
			
		||||
- Scale=0.8
 | 
			
		||||
...
 | 
			
		||||
 | 
			
		||||
<style type="text/css" rel="stylesheet">
 | 
			
		||||
table { table-layout: fixed;}
 | 
			
		||||
</style>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Ссылки
 | 
			
		||||
@@ -22,20 +25,19 @@ monofontoptions:
 | 
			
		||||
sudo apt-get install git
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Подробнее: https://help.github.com/articles/set-up-git/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Термины
 | 
			
		||||
 | 
			
		||||
| Термин             | Определение |
 | 
			
		||||
|--------------------|-------------|
 | 
			
		||||
| Рабочий каталог    | Набор файлов в текущем каталоге |
 | 
			
		||||
| Индекс             | Область с файлами, подготовленными для фиксации |
 | 
			
		||||
| SHA-1              | Уникальный идентификатор, отражающий информацию об истории |
 | 
			
		||||
| Ветка              | Именованная последовательность в истории изменений |
 | 
			
		||||
| Коммит \| Фиксация | Набор файлов, записанных в историю одновременно  |
 | 
			
		||||
| `HEAD`             | Имя ссылки на последнюю фиксацию в текущей ветке |
 | 
			
		||||
| Метка              | Именованная ссылка на некоторую фиксацию в истории |
 | 
			
		||||
 | 
			
		||||
| Термин | Англ | Определение  |
 | 
			
		||||
| ------ | ------ | ----------------------- |
 | 
			
		||||
| Рабочий каталог | working directory | Набор файлов в текущем каталоге                              |
 | 
			
		||||
| Индекс             | index, staging area | Область с файлами, подготовленными для фиксации |
 | 
			
		||||
| SHA-1              | SHA-1                 | Уникальный идентификатор, отражающий информацию об истории |
 | 
			
		||||
| Ветка              | branch              | Именованная последовательность в истории изменений |
 | 
			
		||||
| Фиксация (коммит)  | commit             | Набор файлов, записанных в историю одновременно  |
 | 
			
		||||
| `HEAD`             | `HEAD`                | Имя ссылки на последнюю фиксацию в текущей ветке |
 | 
			
		||||
| Метка              | tag                   | Именованная ссылка на некоторую фиксацию в истории |
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Состояния
 | 
			
		||||
 | 
			
		||||
@@ -62,92 +64,83 @@ staged -> untracked: git rm --cached
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Настройка
 | 
			
		||||
 | 
			
		||||
## $getting-started
 | 
			
		||||
| Команда | Ключи | Описание  |
 | 
			
		||||
| ---- | ---------- | ------------ |
 | 
			
		||||
| `git config` | `--global user.name "John Doe"`           | Имя текущего пользователя   |
 | 
			
		||||
| `git config` | `--global user.email "mail@example.com"`  | Почта текущего пользователя |
 | 
			
		||||
| `git config` | `--list`                                  | Вывод текущей конфигурации  |
 | 
			
		||||
| `git config` | `--global --list`                         | Вывод глобальной конфигурации  |
 | 
			
		||||
 | 
			
		||||
| Command | Options | Description |
 | 
			
		||||
|------------|--------------|---------------------------------------------------------|
 | 
			
		||||
| `git config` | `--global user.name "Cooper Black"`    | Set global user name |
 | 
			
		||||
| `git config` | `--global user.email "cooper@black.com"`    | Set global user email |
 | 
			
		||||
| `git config` | `--list`    | Display configuration |
 | 
			
		||||
| `git config` | `--global --list`  | Display global configuration |
 | 
			
		||||
| `git init` | | Make current directory a git repository |
 | 
			
		||||
| `git remote` | `add origin <url>`| Set remote origin |
 | 
			
		||||
| `git ls-tree` | `-r <branch> --name-only`  | List files being tracked |
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-config
 | 
			
		||||
## Инициализация
 | 
			
		||||
 | 
			
		||||
## $clone
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
| ---- | ------ | ------------ |
 | 
			
		||||
| `git init`  | `<dir>`     | Создать пустой репозиторий в каталоге `<dir>` |
 | 
			
		||||
| `git clone` | `<giturl>`  `<dir>`            | Создать в каталоге `<dir>` копию репозитория, находящегося по адресу `<giturl>` |
 | 
			
		||||
| `git clone` | `--recursive <giturl>` `<dir>` | Создать в каталоге `<dir>` копию репозитория, находящегося по адресу `<giturl>`, с учётом подмодулей |
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| `git clone`   | `<giturl>`  | Clone remote repository into current directory |
 | 
			
		||||
| `git clone`   | `--recursive <giturl>`  | Clone remote repository with submodules |
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-clone
 | 
			
		||||
## Подмодули
 | 
			
		||||
 | 
			
		||||
## $submodule
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
| ---- | ------ | ------------ |
 | 
			
		||||
| `git submodule` | `add <giturl> <dir>`  | Добавить в каталог `<dir>` текущего рапозитория подмодуль, находящийся по адресу `<giturl>`  |
 | 
			
		||||
| `git submodule` | `update --recursive --remote`     | Обновить подмодули |
 | 
			
		||||
| `git submodule` | `sync --recursive`                | Заменить адреса подмодулей на указанные в файле `.gitmodules` |
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| `git clone`     | `--recursive <giturl>`  | Clone remote repository with submodules |
 | 
			
		||||
| `git submodule` | `add <giturl>`  | Add submodule |
 | 
			
		||||
| `git submodule` | `update --remote` | Update submodules |
 | 
			
		||||
| `git submodule` | `status --recursive` | List submodules |
 | 
			
		||||
 | 
			
		||||
**Remove submodule:**
 | 
			
		||||
Удаление подмодуля:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
$ git submodule deinit <path/to/submodule>
 | 
			
		||||
$ git rm <path/to/submodule>
 | 
			
		||||
```sh
 | 
			
		||||
git submodule deinit <path/to/submodule>
 | 
			
		||||
git rm <path/to/submodule>
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-submodule
 | 
			
		||||
## Фиксация
 | 
			
		||||
 | 
			
		||||
## $commit
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
| ---- | ------ | ------------ |
 | 
			
		||||
| `git add` | `<filename>`                | Подготовить файл `<filename>` к фиксации                     |
 | 
			
		||||
| `git commit` |                             | Зафиксировать подготовленные файлы |
 | 
			
		||||
| `git commit` | `-a`                        | Зафиксировать все отслеживаемые файлы, которые были изменены |
 | 
			
		||||
| `git rm` | `<filename>`                | Remove files from the working tree and from the index |
 | 
			
		||||
| `git rm` | `-f <filename>`             | Force deletion of files from disk |
 | 
			
		||||
| `git rm` | `-r --cached <filename>`    | Untrack file (without deleting) |
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| `git add`         | `<filename>`   |  Add files to staging area  |
 | 
			
		||||
| `git commit`      | `-m "<title>" -m "<body>"`  |  Commit with message (includes "added" files only) |
 | 
			
		||||
| `git rm`          | `<filenama>`   |  Remove files from the working tree and from the index |
 | 
			
		||||
|                   | `-f`                |  Force deletion of files from disk |
 | 
			
		||||
| `git rm` | `-r --cached <filename>`  | Untrack file (without deleting) |
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-commit
 | 
			
		||||
## Информация
 | 
			
		||||
 | 
			
		||||
**Untrack hidden files, or update list of tracked files, after adding `.gitignore`:**
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
| ---- | ---- | ------------ |
 | 
			
		||||
| `git status` | `-s`            | Вывод информации о рабочем каталоге в краткой форме |
 | 
			
		||||
| `git log`    | `--oneline` | Вывод журнала изменений в краткой форме |
 | 
			
		||||
| `git ls-files` |             | Вывод списка отслеживаемых и подготовленных файлов |
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
# remove all
 | 
			
		||||
$ git rm -r --cached .
 | 
			
		||||
 | 
			
		||||
# add all again, now gitignore will take effect (try to add .gitignore from the start next time)
 | 
			
		||||
$ git add .
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## $push branches (see tags for pushing tags)
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
| ---- | ------ | ------------ |
 | 
			
		||||
| `git push`    | `<remotename> <branchname>`     | Push branch to remote |
 | 
			
		||||
| `git push`    | `<remotename> --all`            | Push all branches to remote |
 | 
			
		||||
| `git push`    | `--d <remotename> <branchname>` | `--delete` remote branch |
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-push
 | 
			
		||||
 | 
			
		||||
## $remote
 | 
			
		||||
 | 
			
		||||
- Remote connections are like bookmarks named after remote repos
 | 
			
		||||
- `git clone` automatically creates a remote connection usually called `origin`
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
|---------|-------|----------|
 | 
			
		||||
| `git remote` | `-v`                         | List remote repository endpoints |
 | 
			
		||||
| `git branch` | `-r`                         | List remote repository branches |
 | 
			
		||||
| `git remote` | `add <name> <url>`           | Create namespaced connection to a remote repository |
 | 
			
		||||
| `git remote` | `rename <oldname> <newname>` | Rename connection |
 | 
			
		||||
| `git remote` | `rm <name>`                  | Remove connection |
 | 
			
		||||
| `git remote`  | `add origin <url>` | Set remote origin |
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-remote
 | 
			
		||||
 | 
			
		||||
@@ -162,8 +155,9 @@ git rm .git/FETCH_HEAD
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## $fetch-pull
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
|---------|-------|----------|
 | 
			
		||||
| `git fetch`     | `<remote>`     | Fetch all branches from remote (without merge) |
 | 
			
		||||
| `git fetch`     | `<remote> <branch>`     | Fetch specific branch |
 | 
			
		||||
| `git merge`     | `<remote>/<branch>`     | Merge fetched remote |
 | 
			
		||||
@@ -174,8 +168,8 @@ Reference: https://git-scm.com/docs/git-fetch, https://git-scm.com/docs/git-pull
 | 
			
		||||
 | 
			
		||||
## $branch
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
|---------|-------|----------|
 | 
			
		||||
| `git branch`        |                   | List branches |
 | 
			
		||||
| `git branch`        | `<branchname>`    | Create new branch |
 | 
			
		||||
| `git checkout`      | `<sha-1>`         | Switch to branch, or commit |
 | 
			
		||||
@@ -185,20 +179,10 @@ Reference: https://git-scm.com/docs/git-fetch, https://git-scm.com/docs/git-pull
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-branch
 | 
			
		||||
 | 
			
		||||
## $status
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| `git status`  | `-s`        | Show the working tree status, with `--short` format |
 | 
			
		||||
| `git log`     | `--oneline` | Show commit logs, with `--oneline` format |
 | 
			
		||||
| `git ls-files`|             | Show information about files in the index and the working tree |
 | 
			
		||||
 | 
			
		||||
Reference: https://git-scm.com/docs/git-status
 | 
			
		||||
 | 
			
		||||
## $diff
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
|---------|-------|----------|
 | 
			
		||||
| `git diff`  |             | Compare **`working directory`** and **`index`** |
 | 
			
		||||
|             | `–-cached`  | Compare **`index`** and **`latest commit`** |
 | 
			
		||||
|             | `HEAD`      | Compare **`latest commit`** and **`working directory`** |
 | 
			
		||||
@@ -220,8 +204,8 @@ $ git diff --stat a649900 24bdd58 ./path/README.md
 | 
			
		||||
 | 
			
		||||
## $tag
 | 
			
		||||
 | 
			
		||||
| Command     | Options     | Description |
 | 
			
		||||
|-------------|-------------|---------------------------------------------------------|
 | 
			
		||||
| Команда | Ключи | Описание |
 | 
			
		||||
|---------|-------|----------|
 | 
			
		||||
| `git tag`           |                   | List tags |
 | 
			
		||||
| `git tag`           | `<v1.0.0>`        | Create tag, from latest commit, lightweight |
 | 
			
		||||
| `git tag`           | `-a <v1.0.0> -m "<msg>"` | Create tag, with `--annotate`, from latest commit |
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user