The 10 essential commands every developer needs
git init
Start a new repository in current folder
git clone [url]
Copy a remote repository to your machine
git status
Check what's changed
git add .
Stage all changes for commit
git commit -m "message"
Save staged changes with a message
git push
Upload commits to remote
git pull
Download and merge remote changes
git branch [name]
Create a new branch
git checkout [branch]
Switch to a different branch
git merge [branch]
Merge branch into current branch
git log --oneline
View commit history (compact)
git diff
See what changed (unstaged)
git stash
Temporarily save uncommitted changes
git reset --hard HEAD
Discard all local changes ⚠️
Create a .gitignore file to exclude files from tracking. Common entries: node_modules/, .env, .DS_Store