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

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

git log --format="%h %an %ad"

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

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>

Header image courtesy of