Git Cheat Sheet - Every Command You Need (2026)
DevTools StoreGit Cheat Sheet (2026)
Every Git command you need in one page. Bookmark this.
Setup
git init # Initialize repo git clone <url> # Clone remote repo git config user.name "Your Name" # Set name git config user.email "you@x.com" # Set email
Basic Workflow
git status # Check status git add <file> # Stage file git add . # Stage all changes git commit -m "message" # Commit git push # Push to remote git pull # Pull from remote
Branching
git branch # List branches git branch <name> # Create branch git checkout <name> # Switch branch git checkout -b <name> # Create + switch git merge <name> # Merge branch into current git branch -d <name> # Delete branch
Undoing Changes
git restore <file> # Discard unstaged changes git restore --staged <file> # Unstage file git reset HEAD~1 # Undo last commit (keep changes) git reset --hard HEAD~1 # Undo last commit (discard changes) git revert <commit> # Create new commit undoing changes
Viewing History
git log --oneline # Compact log git log --graph --oneline # Branch graph git diff # Unstaged changes git diff --staged # Staged changes git show <commit> # Show commit details
Stash
git stash # Stash changes git stash list # List stashes git stash pop # Apply + remove stash git stash drop # Remove stash
Remote
git remote -v # List remotes git remote add origin <url> # Add remote git push -u origin main # Push + track git fetch # Download remote data git pull --rebase # Pull with rebase
Get 7 developer products (SaaS boilerplate, React hooks, Tailwind components, and more). Pay what you want:
Get the Complete Bundle