I'm currently working on a project using git as my version control system.
Often I'm halfway through making some change or other and an unrelated bug becomes apparent. It's an easy fix and so I go ahead and fix it but then I can't make a clean commit. I found out today how to handle this.
- Save the work in progress before the unrelated bug is fixed and run
- The source tree is now clean -- the unfinished changes have disappeared. Reload the file in vim and fix the small bug.
- Commit the patch
- Restore (and merge if necessary) the stashed tree with
git stash pop