Advanced Git Workflows — Work Like a Senior Developer
Master the Git commands that separate junior devs from seniors:
Stash Workflow:
```cmd
git stash # Save current work temporarily
git checkout main # Switch to fix urgent bug on main
git pull # Get latest changes
# ... fix bug, commit ...
git checkout feature # Go back to your feature branch
git stash pop # Restore your WIP work
`
Interactive Rebase (Clean Up Commits):
```cmd
git rebase -i HEAD~5 # Edit last 5 commits interactively
`
- pick — keep commit
- squash — merge into previous commit
- reword — change commit message
- drop — delete commit
Cherry-Pick (Port a Fix to Another Branch):
```cmd
git log --oneline # Find commit hash
git cherry-pick a1b2c3 # Apply just that commit here
`
These three commands will save you in real projects every week! 💪
