Don't fix multiple issues in the same git branch

I have been guilty of fixing multiple git issues in a single git branch. I have done it several times without any consequences. But this is wrong.

Your git workflow may be similar to this:

You create a git branch to fix an issue. But as you work on the issue, you notice a simple, unrelated bug. Fixing the unrelated issue in the active branch should not have any consequences. So you fix and commit the unrelated, seemingly minor issue, and move on to fix the original issue.

I have done this. Sometimes it has been to correct an incorrect comment. Sometimes to remove methods/functions that are no longer used. And I understand your logic. "Why should I create a new branch for an issue that can be fixed on the fly in the active branch?" I get it. I have asked the same question. But I'm afraid that we are wrong.

Stop the urge of fixing multiple issues in a single git branch. If you find an issue, log it and create a new branch for it. No matter how minor the issue is, create a new branch for it. Because as your project increases in complexity, so is the need to keep issues logged and organized.

Harold Serrano

Computer Graphics Enthusiast. Currently developing a 3D Game Engine.