Piecemeal Feature Development and Merging

Hgk

Branching and merging is a staple of team software development, since it's very important that programmers working on the same code base don't mess with each other's changes. But while branching is fun (and hassle free in git), merging is quite often a big pain. The longer the programmer stays in his own branch the more his code diverges from master. A good rule of thumb is that branches should be synced with master every day so that the branches do not diverge too much from the master. If the whole feature can be developed in a single day, than merging it back into a master on the same day is not a problem. But if the feature is big and is developed over several days it cannot be merged into the master piecemeally without changing the development practices. The most important change in development practices is to break down the feature into several smaller pieces where each piece can be merged into master (and preferably deployed to the production) independently. If any of the pieces interferes with the existing functionality, the existing code should be refactored and made more extensible. I've heard several programmers objecting to this approach with an argument that it will make development longer. In my experience, the initial development of a complex feature in a piecemeal approach really takes longer, but once the feature is finished it's really done. On the other hand I've heard too many programmers uttering the famous phrase "I've finished the feature. I only need to merge it into master" followed by several days of frustrations when the "finished" feature is being shoved into the master.