Release a feature in increments

If you’re building a feature that can gradually be pushed to the main branch and production without causing any issues to the existing pages, don’t wait to build it to completion in a feature branch and merge it only when it’s ready for production. If you can push changes that are not visible to the user and can be merged to production independently, just build it, push it and merge it without ever touching the feature branch. It will reduce the headache of doing the code review of the entire feature and reduce the potential merge conflict hell.

An example of this is something like dark mode. If you’re planning on adding a dark mode to the website and are using something like Tailwind CSS, there’s no reason to open a dark-mode branch and push all the design changes until the team finishes the dark mode for every page. At that point, you will open a PR and see 5000 additions, and the entire PR is an accident waiting to happen with potentially a conflict hell. Just add dark mode styles for one page at a time, review, merge, and push to production. It’s not visible to the user until you “globally enable” the dark mode. Once all the pages are optimized for dark mode, globally enable the dark mode styles (Tailwind’s darkMode option in the config file) and done. Every page can now be reviewed separately, you reduced the conflict hell and have chunked this big feature into smaller PRs.

Another example can be adding something like a blog to the existing website. You can create all the backend logic you need for the blog, such as models, migrations, internal pages with a WYSIWYG editor for your content writers, and page designs, and have them all reviewed and merged to the main branch; but have a feature flagging disable the blog for every user until everything is ready for it. Even without feature flags, you can just do all the work for the blog, but just comment out the parts accessible/visible to the user. There’s really no need to do the work in the blog branch and then merge it once it’s fully finished. Just imagine reviewing hundreds of files for that one feature.

With this approach, if the team moves away from the feature for some time due to other higher priorities, your backend logic is already merged in and deployed and is not sitting there in a stale feature branch. This is just something that came across my mind in the recent past.

I'm available for software development contract work and consulting at [email protected]