← Back to Spider On The Web

Git Commands Cheat Sheet

The 10 essential commands every developer needs

Getting Started

git init Start a new repository in current folder
git clone [url] Copy a remote repository to your machine

Daily Workflow

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

Branching

git branch [name] Create a new branch
git checkout [branch] Switch to a different branch
git merge [branch] Merge branch into current branch

Useful Extras

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 ⚠️
💡 Pro Tip

Create a .gitignore file to exclude files from tracking. Common entries: node_modules/, .env, .DS_Store

Copied to clipboard!