Git Cheat Sheet
A quick reference for the most commonly used Git commands and workflows.
Getting Started
| Init repo | git init |
| Clone repo | git clone <url> |
| Configure user | git config --global user.name 'Name' |
| Configure email | git config --global user.email 'email' |
Daily Workflow
| Status | git status |
| Stage file | git add <file> |
| Stage all | git add -A or git add . |
| Commit | git commit -m 'message' |
| Commit with all staged | git commit -am 'message' |
| Push | git push origin <branch> |
| Pull | git pull origin <branch> |
Branching
| List branches | git branch |
| Create branch | git branch <name> |
| Switch branch | git checkout <name> |
| Create & switch | git checkout -b <name> |
| Merge branch | git merge <branch> |
| Delete branch | git branch -d <name> |