Fundamental Commands

git clone
git add some/file/name.js
git commit -m "Commit message"
git push
git pull
git log --oneline -10

Intermediate Commands

git add -u
git add -A // avoid this in favour of -u

git commit --amend --no-edit
git commit --amend -m "Commit message"

git reset
git reset --soft HEAD
git reset --hard HEAD

git checkout -b some-branch-name
git checkout -b some-new-branch-name

git merge some-branch-name-to-merge

git rebase some-branch-name-onto-which-to-rebase
git checkout --theirs
git checkout --ours

git branch
git branch -r
git branch -a
git branch -vv

git diff some-branch --stat=200 --relative
git diff some-branch --name-status
git diff some-branch --name-only
git diff some-branch -- . ':(exclude)*.ts'

Advanced Commands

// Get the current branch name only
git rev-parse --abbrev-ref HEAD

git push --force-with-lease
git push --delete origin some-branch-name
git push --follow-tags

git tag tagname commit-hash

git remote -v

git cherry-pick

git bisect start
git bisect good
git bisect bad

git log --graph --oneline --decorate --all -10

git log --since=yesterday
git log --since=aug-25

git log -G<regex>
git log -S<regex> --pickaxe-regex

// log with a custom format
// https://www.git-scm.com/docs/git-log#_pretty_formats
git log --format="%h %an %ad %s %d"

git diff some-branch --stat=200 --relative

// Git diff and ignore renames
git diff integration --diff-filter=MAD --name-status

// compare files in the same branch
git diff --no-index file1 file2
git diff --no-index dir1/ dir2/

git reflog -10

// find the 'best' common ancestor of two commits
git merge-base some-branch HEAD

git diff branch1...branch2
git diff branch1..branch2
git diff branch1 branch2

// Search branches by name
git branch --list --all <pattern>

// Rebase a range of commits
git rebase --onto master 797ab6ca2

// disable the pager once
git --no-pager diff master

// list remote branches with name of most recent comitter
git for-each-ref refs/remotes --format="%(refname) - %(authorname)"

Configuration Commands

// disable the pager always
git config --global --replace-all core.pager "less -F -X"

Header image courtesy of http://www.peakpx.com/460920/witch-spell-book