Git Command Cheat Sheet
Quick reference for common Git commands. Free, no signup.
Setup
git initInitialize a new Git repository
git clone <url>Clone a repository
git config user.name "name"Set username
git config user.email "email"Set email
Staging
git add .Stage all changes
git add <file>Stage a specific file
git reset <file>Unstage a file
Status
git statusShow working tree status
git diffShow unstaged changes
git diff --stagedShow staged changes
Commit
git commit -m "msg"Commit staged changes with message
git commit --amendAmend the last commit
Log
git log --onelineShow compact commit history
git log --graph --onelineShow branching history
git log -pShow commit history with diffs
Branch
git branchList local branches
git branch <name>Create a new branch
git checkout <branch>Switch to a branch
git checkout -b <name>Create and switch to new branch
git merge <branch>Merge a branch into current
git branch -d <name>Delete a branch
git rebase <branch>Rebase current branch onto another
Remote
git fetchFetch remote changes
git pullFetch and merge remote changes
git pushPush local commits to remote
git push -u origin <branch>Push and set upstream
git remote -vList remote repositories
Stash
git stashStash current changes
git stash popApply and remove last stash
git stash listList all stashes
git stash dropDelete last stash
Advanced
git cherry-pick <hash>Apply a specific commit
git reset --soft HEAD~1Undo last commit, keep changes
git reset --hard HEAD~1Undo last commit, discard changes
git revert <hash>Create a commit that undoes changes
git tag <name>Create a lightweight tag
git clean -fdRemove untracked files and dirs
git blame <file>Show who changed each line
🎉 100% Free. Quick reference for all Git commands.