Making only one change per commit

After the routine morning coffee, you open your editor and then you start to work on a bug: BUG42. Working around fixing the bug in the code, you realize that fixing BUG79 will require tweaking just a single line of code, so you fix it, but you not only change that awful class name, but also add a good-looking label to the form and make a few more changes. The damage is done now.

How can you now wrap up all that work in a meaningful commit? Maybe in the meantime you went home for lunch, talked to your boss about another project, and even you can't remember exactly all the little things you did.

In this scenario, there is only one way to limit the damage: split files to commit in more than one commit. Sometimes this helps to reduce the pain, but it is only a palliative: too often you modify the same file for different reasons, so doing that is quite difficult, if not impossible.

The only way to solve this problem completely is to only make one change per commit. It seems easy, I know, but is quite difficult to acquire this ability. There are no tools for it; no one but you can help, as it requires discipline, the most lacking virtue in creative people (like programmers).

There are some tips to pursue this aim; let's have a look at them together.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.117.109