While working in a branch I wanted to switch back to the master branch to see how a previous implementation worked. When I tried to switch branches with checkout I got a message saying I would lose the changes in my current branch if I switched without committing. The message suggested I commit or stash my changes before switching.
I didn’t want to commit the changes in this branch (because they weren’t working just yet) so I checked out Git’s stash command. It turned out to be exactly what I wanted.
After stashing the changes in the current branch I was able to checkout master, review the code in that branch, and return to the previous branch and my broken code.