## Essential Git Commands Every Developer Should Know
Git is the backbone of modern version control. Whether you’re working solo or on a team of 50, these commands will cover 95% of your daily workflow.
### Configuration
“`bash
git config –global user.name “Your Name”
git config –global user.email “your@email.com”
git config –global init.defaultBranch main
git config –global alias.co checkout
git config –global alias.br branch
git config –global alias.st status
“`
### Starting a Repository
“`bash
git init # Create new repo
git clone
git clone –depth 1
“`
### Daily Workflow
“`bash
git status # See what’s changed
git add
git add . # Stage all changes
git commit -m “message” # Commit staged changes
git commit -am “message” # Add and commit in one step
git push origin main # Push to remote
git pull # Pull latest changes
“`
### Branching
“`bash
git branch
git checkout
git checkout -b
git branch -d
git merge
“`
### Undoing Changes
“`bash
git restore
git restore –staged
git reset –soft HEAD~1 # Undo last commit (keep changes)
git reset –hard HEAD~1 # Undo last commit (discard changes)
git revert
“`
### Stashing
“`bash
git stash # Save uncommitted work
git stash pop # Restore latest stash
git stash list # List stashes
git stash drop # Delete latest stash
“`
### Viewing History
“`bash
git log –oneline # Compact history
git log –graph –all # Visual branch history
git diff # Show unstaged changes
git diff –staged # Show staged changes
git blame
“`
### Working with Remotes
“`bash
git remote -v # List remotes
git remote add origin
git fetch origin # Fetch without merging
git pull –rebase # Pull with rebase
“`
### Advanced
“`bash
git cherry-pick
git rebase -i HEAD~3 # Interactive rebase
git bisect start # Binary search for bugs
git submodule add
“`
—
**📚 Want all these commands in a printable reference?** Download the [Git Commands Cheat Sheet ($2.99)](https://ovidia1.gumroad.com/l/devops-git) with 70+ commands covering GitFlow, interactive rebase, submodules, and troubleshooting.
**💡 Browse the full collection:** [DevOps Cheat Sheets](https://ovidia1.gumroad.com) — 15+ quick references for developers and sysadmins. Use code **LAUNCH20** for 20% off.