4 ms·
> Committing the red test and the fix to the test in two commits makes the bug and its fix easy to review. I don't think this is compelling argument. Normally
by tomtomtom777 7y ago
> Committing the red test and the fix to the test in two commits makes the bug and its fix easy to review.
I don't think this is compelling argument. Normally the test and the fix are looked at together and are already sufficiently separated in the code.
It makes more sense to me to use a single commit so the fix can be described in a single commit message, keeping the history clean.
- roblabla 7y agoKeeping it separate allows ensuring the test works easily: just revert the fix keeping only the patch for the test and make sure the test fails. My workflow tend to be to keep them separate, and write a big description in the merge commit rather than the individual commits (those have a small description of the local change). There's tradeoffs to both approach though, and as you mention, it's easier to keep track of the provenance of a fix in the git blame when it's unified in a single commit message.
- lejar 7y agoI totally understand why you would do that and it makes sense, but I personally like to keep them in one commit so that I won't get any problems with an automated git bisect later.