Fixing a bug while working on a different part of the code base

Posted by imgx64 on Programmers See other posts from Programmers or by imgx64
Published on 2010-09-27T12:57:23Z Indexed on 2010/12/27 14:58 UTC
Read the original article Hit count: 225

Filed under:
|

This happened at least once to me. I'm working on some part of the code base and find a small bug in a different part, and the bug stops me from completing what I'm currently trying to do. Fixing the bug could be as simple as changing a single statement.

What do you do in that situation?

  1. Fix the bug and commit it together with your current work
  2. Save your current work elsewhere, fix the bug in a separate commit, then continue your work [1]
  3. Continue what you're supposed to do, commit the code (even if it breaks the build fails some tests), then fix the bug (and the build make tests pass) in a separate commit

[1] In practice, this would mean: clone the original repository elsewhere, fix the bug, commit/push the changes, pull the commit to the repository you're working on, merge the changes, and continue your work.

Edit: I changed number three to reflect what I really meant.

© Programmers or respective owner

Related posts about bugs

Related posts about version-control