LOG:

elements limit:
git log -2

patch:
git log -p

oneline:
git log --pretty=oneline

filters:
git log --since=2.weeks --author=trilolol --grep=keywords

function:
git log -S function_name

branches logging:
git log --decorate
or
git branch


Config:

levels:
git config --local
git config --global
git config --system

remove entry:
git config --unset <key>

replace working directory on push:
git config receive.denyCurrentBranch updateInstead


Changes:

git status

Diff indexed - working dir:
git diff

Diff indexed - commit:
git diff --staged (или --cached)


Tools:
git difftool --tool-help
git difftool --tool=<smerge>
git difftool


Commits:

commit with message
git commit -m "message"

autoindex:
git commit -a

inlude current index in previous commit:
git commit --amend


Remove files:

Remove from repository:
git rm <file>

Remove from index:
git rm --cached <file>

Unindex:
git reset -- <file>

Move sequence (rm-add):
git mv <from> <to>

Revert changes:
git checkout -- <file>


Branches:

new branch:
git checkout -b <branch name>
или:
git branch <branch name>
или:
git switch -c <branch name>

switch branch:
git checkout <branch name>
или:
git switch <branch name>


Merging:

step 1, switch to original branch:
git switch master
step 2, run command specifying branch that will be merged in original:
git merge hotfix

conflicts:
git  mergetool


Remote:

add:
git remote add <name> <url>
git remote add name trilolol@example.com:/var/www/folder

rename:
git remote rename <name1> <name2>

upload updates:
git push <name> <branch>

download updates
git pull <name> <branch>