Git

$ git help
$ git help commit

Конфигурирование

$ git config --global user.name "UserName"

$ git config --global user.email "email@email.ru"

$ git config --list
user.name=UserName
user.email=email@email.ru

$ cat ~/.gitconfig
[user]
    name = UserName
    email = email@email.ru

Инициализация

$ git init

Состояние

$ git status

Индекс

# добавление измененй в индекс
$ git add .
$ git add index.html

# просмотр изменений
$ git diff
$ git diff --staged

# вернуть файл в исходное состояние
$ git checkout index.html

# вернуть файл в состояние, как в указанном комите
$ git checkout commit_hash index.html

# удалить изменения из индекса
$ git reset HEAD index.html

# удалить файл из репы
$ git rm index2.html
# без физического удаления файла с диска
$ git rm --cached index2.html

Комит

$ git commit -m "commit message"
$ git commit --amend -m "new commit message"
$ git commit --amend --no-edit

$ git log
$ git log -1
$ git log --oneline
$ git log --oneline --all
$ git log --oneline --all --graph

$ git show commit_hash

$ git cat-file -p commit_hash

Ветки

$ git checkout commit_hash
$ git checkout -b new_branch

$ git merge new_branch -m "merge commit"
# после переименования репозитория на гитхабе
git remote set-url origin http://github.com/ilnurgi/gii_docs.git