Here’s the sequence to follow when using git stash:
- Save changes to branch A.
- Run
git stash.
- Check out branch B.
- Fix the bug in branch B.
- Commit and (optionally) push to remote.
- Check out branch A
- Run
git stash pop
to get your stashed changes back.
Listing your stashes
git stash list