Deep in feature dev when P0 production bug hits. Must fix, deploy, then resume without losing anything.
Feature branch has uncommitted changes. Bug is in payment module — separate from your feature.
Medium · 7 steps · +500 XP
This scenario walks through 7 steps, in order:
Try the terminal first — you learn more by doing. When you want to check yourself, here is the command for each step.
git stash -ugit switch maingit switch -c hotfix/paymentgit commit -am "fix: payment null"git push -u origin hotfix/paymentgit switch feature-analyticsgit stash popHotfix shipped, feature restored! Stash + branching = zero loss.