BeginnerPhone
2 min
Git Stash vs Creating a Branch
GitVersion Control
Advertisement
Interview Question
When would you use git stash instead of committing to a new branch, and what are the trade-offs?
Key Points to Cover
- `git stash` saves dirty state without a commit; branch creates explicit history
- Stash is temporary and stack-based; branches are shareable and reviewable
- Use stash for quick context switches; branch for collaborative work
Evaluation Rubric
Explains stash purpose and behavior34% weight
Explains branch pros/cons33% weight
Gives correct usage scenarios33% weight
Hints
- 💡Mention `git stash list` / `stash pop` / `stash apply`.
Potential Follow-up Questions
- ❓How do you stash untracked files?
- ❓How do you name a stash?
Advertisement