DEV Community

Pawel Kadluczka
Pawel Kadluczka

Posted on

Why you should always merge your diffs promptly

One of the things that continue to amaze me daily is developers who delay merging approved diffs.

All the hard work is done - the diff has been written, reviewed and approved. The only remaining action is to execute a few commands or just press a button. But for some reason, it’s not happening.

There are no upsides to putting off the merging of approved diffs but there are plenty of downsides. The most evident one is merge conflicts. While the diff is on hold, other diffs are getting merged, and the longer the delay, the bigger the risk of having to deal with merge conflicts. In extreme cases, like bigger refactoring, the entire change may need to be redone. This isn't just a waste of the who made the original change. Since the new change needs to be reviewed again, it's also a waste of time for everyone else.

Delaying the merging of diffs can lead to unnecessary drama. People, especially those who reviewed the code, may work under the assumption that the changes are already merged. When they find out it's not the case, it forces them to alter their plans or deal with merging the diff themselves, leading to unnecessary hassle.

With many years in the industry, I've observed an interesting phenomenon: it is not uncommon for the same bug to be independently discovered by multiple people around the same time. Delaying the merging of a fix increases the likelihood that another person on your team encounters the same bug. Unaware that a fix has already been prepared, they may decide to fix it which will result in unnecessary duplicated effort.

Holding off on merging diffs, can lead to other sticky situations. For instance, if a release branch has been cut, the change won’t be included. This creates a dilemma - either the product will ship without the change, or the change will need to be hastily merged not giving it enough time to discover potential issues. Another scenario is when external circumstances like code freeze or going on vacation, postpone merging the change even further only amplifying all the problems mentioned earlier.

Finally, all unfinished tasks - including waiting-to-be-merged diffs - take a toll on our mental capacity (Zeigarnik effect). The brain tends to remind us of them at the most inconvenient times resulting in unnecessary stress and anxiety.

The take away is simple: avoid procrastination. Run these commands, click the green button and get your diff merged. You’ll have to do this sooner or later, otherwise why you even bothered to write and send the diff in the first place?

Top comments (0)