TEMPORARY COMMITS
Temporarily
store modified, tracked files in order to change branches
git stash
Save modified and staged changes
git stash list
list stack-order of stashed file changes
git stash pop
write working
from top of stash stack
git stash drop
discard the changes from top of stash stack
REWRITE HISTORY
Rewriting
branches, updating commits and clearing history
git rebase [branch]
apply any commits of current branch ahead of specified one
git reset --hard [commit]
clear
staging area, rewrite working tree from specified commit
INSPECT & COMPARE
Examining logs, di
ff
s and object information
git log
show the commit history for
the currently active branch
git log branchB..branchA
show the commits on branchA that are not on branchB
git log --follow [file]
show the commits that changed file, even across renames
git diff branchB...branchA
show the di
ff
of what is in branchA that is not in branchB
git show [SHA]
show any object in
Git in human-readable format
IGNORING PATTERNS
Preventing unintentional staging or commiting of files
git config --global core.excludesfile [file]
system
wide ignore pa
tt
ern for all local repositories
logs/
*.notes
pattern*/
Save a file with desired pa
tt
erns as
.gitignore
with
either direct string
matches or wildcard globs.