📦
Daily workflow
| Command | Description | |
|---|---|---|
git status | Changed files and branch | |
git pull --rebase origin main | Update branch with rebase | |
git add -p | Stage hunks interactively | |
git commit -m "feat: message" | Commit staged changes | |
git push -u origin feature-branch | Push and set upstream |
Branch & merge
| Command | Description | |
|---|---|---|
git branch -a | Local and remote branches | |
git checkout -b feature/x | Create and switch branch | |
git merge main | Merge main into current branch | |
git rebase main | Rebase onto main | |
git branch -d feature/x | Delete merged branch |
Undo & stash
| Command | Description | |
|---|---|---|
git stash push -m "wip" | Save WIP changes | |
git stash pop | Restore latest stash | |
git revert <commit> | Safe undo — new commit | |
git reset --hard origin/main | Discard local commits (destructive) | |
git log --oneline -10 | Recent commits |