git initCreate a new local Git repo
git clone [url]Copy a repo
git add [file]Stage changes to tracked and untracked files
git commitCommit previously staged changes
git push origin HEADPush local changes to the origin
git pullFetch remote version and update local branch
git statusShow the status of your working directory
git help [command]Use this when you are stuck
git branch --allList all the local and remote branches
git checkout [branch]Change to an existing branch
git merge [branch]Merge branch changes into current branch
git log --graph --onelineShow a pretty branch history
git diffSee specific local changes
git diff --oursCompare the working tree with our branch
git diff --theirsCompare the working tree with their branch
git archiveCreate release tarball
git cherry-pick [commit-id]Enable arbitrary Git commits to be picked by reference
git reset --hardReset to a specific commit (destructive)
⚠️ Destructive
Git Workflow
Working Dir
Staging
Local Repo
Remote
Git Terminology
mainDefault primary branchoriginDefault upstream branchHEADCurrent branchHEAD^Parent of HEADHEAD~3Great grandparent of HEAD