Git stash has been a handy command in my workflow for checking whether a test covers the bug.
My usual workflow is:
git stash push /path/to/files
git stash pop
and ensure that they are passing nowThis way I avoid writing tests before writing the code that fixes a bug, and I've still ensured the test covering the bug is not a false positive - it was failing when I have stashed my code changes.
Stashing only the code changes that fix the bug is critical for this workflow. Git has added support for stashing individual files since version 2.13, so make sure to update it if you're using an older version.