I always try to either be refactoring or changing behavior but not both at the same time. That has kept me out of a lot of trouble.
I always try to either be refactoring or changing behavior but not both at the same time. That has kept me out of a lot of trouble.
> "For each desired change, make the change easy (warning: this may be hard), then make the easy change"[0]
[0] https://twitter.com/KentBeck/status/250733358307500032
Edit: Added a link to his first Tweet containing the quote that I know of.
Keep those tasks separate.
The biggest benefit is that it makes code reviews easier for others because the reviewer can step through each commit. This makes the refactoring changes much more obvious.
Splitting the commits also makes it much easier to roll back a functional change that goes wrong or isn't needed while still keeping the refactoring improvements.