Developer Cheatsheets

Quick-reference cards for Git, Docker, Linux, SQL, Vim, and Regex.

Setup
git config --global user.name 'Name'Set global username
git config --global user.email 'email'Set global email
git initInitialize a new repository
git clone <url>Clone a remote repository
Staging & Commits
git add .Stage all changes
git add <file>Stage specific file
git commit -m 'message'Commit with message
git commit --amendModify the last commit
git statusShow working tree status
git diffShow unstaged changes
Branching
git branchList all branches
git branch <name>Create a new branch
git checkout -b <name>Create and switch to branch
git switch <name>Switch to a branch
git merge <branch>Merge branch into current
git rebase <branch>Rebase current onto branch
git branch -d <name>Delete a branch
Remote
git push origin <branch>Push to remote
git pullFetch and merge from remote
git fetchFetch from remote
git remote -vList remotes
git remote add origin <url>Add remote origin
Undo
git reset --soft HEAD~1Undo last commit (keep staged)
git reset HEAD~1Undo last commit (unstage)
git reset --hard HEAD~1Undo last commit (discard changes)
git stashStash current changes
git stash popApply and remove last stash
git revert <hash>Create a revert commit
👋 Need help with code?