<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mister Weru</title>
    <description>The latest articles on DEV Community by Mister Weru (@misterweru).</description>
    <link>https://dev.to/misterweru</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2035168%2F774353ba-c2e5-4f6f-8434-3027f346d33c.png</url>
      <title>DEV Community: Mister Weru</title>
      <link>https://dev.to/misterweru</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/misterweru"/>
    <language>en</language>
    <item>
      <title>999 Merged PRs. Here’s what I have learnt so far.</title>
      <dc:creator>Mister Weru</dc:creator>
      <pubDate>Tue, 24 Mar 2026 08:47:36 +0000</pubDate>
      <link>https://dev.to/misterweru/999-merged-prs-heres-what-i-have-learnt-so-far-e3</link>
      <guid>https://dev.to/misterweru/999-merged-prs-heres-what-i-have-learnt-so-far-e3</guid>
      <description>&lt;p&gt;So a little background information. My name is Dennis Weru, a software engineer at Workpay, one of the most exciting startups in Africa. I am frontend heavy and most of my work has been on UI of the performance management module. We built it on Next Js utilising the static exports feature. This enables us to achieve very fast load times and very tiny pages as you can see below. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5e2mgsu021yvjg2sjwgu.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5e2mgsu021yvjg2sjwgu.webp" alt=" " width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project was built from scratch starting sometime in April 2023 and multiple developers have contributed to it to date. Starting afresh gave us a lot of flexibility in trying out tools and methodologies that could possibly be integrated into the core Workpay HR and payroll codebase which is built separately.&lt;br&gt;
The performance management codebase has reached a significant milestone which is 999 merged PRs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fox8akrqleyethz8hgjma.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fox8akrqleyethz8hgjma.webp" alt=" " width="800" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are all PRs targeted to the three main branches that we use, I explain this in the next section. These are a few things that I have learnt working on the codebase for close to two years now.&lt;br&gt;
These are a few things that I have learnt working on the codebase for close to two years now.&lt;/p&gt;




&lt;p&gt;Multiple environments, Multiple headaches.&lt;/p&gt;

&lt;p&gt;At Workpay, we have three environments; develop, staging and production.&lt;br&gt;
Develop is the tinker branch and it offers the engineers a place to test their work independent of their laptops. Any engineer can merge to develop anytime once they test their work. This gives us flexibility to test new modules and packages and see how they play with the rest of the codebase. &lt;br&gt;
Staging branch is the product branch and it allows the product team to demo new features to stakeholders and other interested parties. Staging branch is a replica of the production branch with a few additional features. It only contains stable changes that have been tested by the Quality Assurance team and developers can only merge to this branch once QA clears the PRs. &lt;br&gt;
Production branch contains the changes that are available to our active users. PRs are only merged to production once code reviews are complete and the QA approves them for production.&lt;br&gt;
Herein lies the headache, how do we ensure the branches don't diverge too much leading to endless merge conflicts?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fefsp8dhovz3a6ric8fv9.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fefsp8dhovz3a6ric8fv9.webp" alt=" " width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Approach one&lt;/p&gt;

&lt;p&gt;We tried a couple of approaches in this regard. The first approach was as &lt;br&gt;
follows.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Feature branches were always created from develop and the PRs pointed to the same branch.&lt;/li&gt;
&lt;li&gt;After the feature development is complete, the feature branch is tested by the engineer and merged to develop.&lt;/li&gt;
&lt;li&gt;Once the develop branch is tested and cleared by QA, a PR is created and the entire develop branch is merged to staging.&lt;/li&gt;
&lt;li&gt;Another round of tests is done in Staging and after the feature is cleared, a PR is created and the entire staging branch is merged into production.&lt;/li&gt;
&lt;li&gt;Bug fix branches were created from the respective branch that the bug was found and the PRs pointed to the same branch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1w4y6hio75yk04obr40.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq1w4y6hio75yk04obr40.webp" alt=" " width="800" height="1158"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This approach allowed us to move fast since only one PR was ever created for each feature. We had a consistent weekly release cycle which ensured that the develop branch would be merged to staging once a week, the same for the staging branch to production.&lt;br&gt;
Like Murphy's law dictates, everything that could go wrong did. Incomplete features started finding themselves in staging due to a myriad of factors including edge cases or sloppy testing. This lead to work getting stuck in staging for longer than the one week release period as bugs were resolved. &lt;br&gt;
The worst case was a major feature that was merged into staging before a couple or edge cases had been looked at. Fixing all the edge cases took close to two months. During the two months, all the other fixes and small features that were to go to production could not move before the major feature was shipped. Some branches went stale, it began to stink, you can imagine how this looked to the executives at the company.&lt;/p&gt;




&lt;p&gt;Approach Two&lt;/p&gt;

&lt;p&gt;Something had to be done. We worked on a new development approach;&lt;br&gt;
Feature branches are always created from production and the PRs always point to production.&lt;br&gt;
Once the feature is complete, the developer alerts the QA personnel who in turn tests the work from the feature branch locally.&lt;br&gt;
The developer then creates an additional two PRs from the feature branch. One to staging and another to develop.&lt;br&gt;
Before merging the develop and staging PRs, you have to rebase them with their respective branches. This will ensure that you resolve any conflicts that may come up.&lt;br&gt;
The developer merges the develop PR.&lt;br&gt;
QA tests the work in the develop environment and clears it for staging. &lt;br&gt;
Developer merges the staging PR and QA does the final round of tests.&lt;br&gt;
The feature branch is merged to production.&lt;br&gt;
Bug fix branches were created from the respective environment they were reported and target the same branches.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ys0bl58ejohgn728wmr.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ys0bl58ejohgn728wmr.webp" alt=" " width="800" height="1136"&gt;&lt;/a&gt;&lt;br&gt;
This new approach showed a few improvements over the previous model. Since all branches were created from production, we could ensure that we're always starting from stable code before adding features or improvements. &lt;br&gt;
It also allowed us to have small PRs that could quickly go through the development cycle without halting other ongoing tasks. We were able to ship stuff more frequently since we did not have to wait for big releases to introduce features. Bugs found on an individual feature branch did not halt the development of other features. &lt;br&gt;
Then came the fuckening. Having to maintain three separate PRs for the same feature meant more work for the developers who  had to constantly rebase the feature branches with the respective target branch. &lt;br&gt;
Work was rarely merged to production in the same order as develop and staging. This in turn meant that any branch created from production will always have conflicts with staging and develop due to the different commit histories. &lt;br&gt;
The more time went by, the harder and more complex the rebases became. It got to a point that for all branches going to staging or develop, the developer had to resolve conflicts for more than 20 commits. Getting this right every time was hard and some bugs started creeping up simply due to the rebasing process. It was also very time consuming.&lt;/p&gt;




&lt;p&gt;Approach Three&lt;/p&gt;

&lt;p&gt;It was time to switch things up. The main issue we were facing was due to all branches originating  from production. We made a decision to make use of transition branches which were always created from the respective target branches. The flow went like this;&lt;br&gt;
Feature/Chore branches are always created from production.&lt;br&gt;
Once the code is complete, the developer creates a PR to production and alerts the QA personnel who in turn tests the work from the feature branch either locally or using Cloudflare preview links.&lt;br&gt;
The developer then creates an additional two PRs. One from develop and one from staging using a similar name to the production branch. All we do is add '-develop' or '-staging' at the end.&lt;br&gt;
Before merging the develop and staging PRs, you have to rebase them with their respective branches. This will ensure that you resolve any conflicts that may come up. &lt;br&gt;
The developer merges the develop PR.&lt;br&gt;
QA tests the work in the develop environment and clears it for staging.&lt;br&gt;
Developer merges the staging PR and QA does the final round of tests.&lt;br&gt;
The feature branch is merged to production.&lt;br&gt;
Bug fix branches were created from the respective environment they were reported and target the same branches.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvb8orojyerkekkk0th0n.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvb8orojyerkekkk0th0n.webp" alt=" " width="800" height="1220"&gt;&lt;/a&gt;&lt;br&gt;
We finally settled on Approach three since it allowed us a couple of advantages. &lt;br&gt;
First, work could be tested using Cloudflare preview links from the PR. This freed up time required to merge the work to the develop environments. &lt;br&gt;
Second, the process was also less messy incase some of the work had issues. Previously, we had to revert the branch from develop, but using preview links we could test the changes without merging work&lt;br&gt;
Third, the cloudflare CI added an additional layer of confidence since the pipeline has to build the work and run linter checks. For work that does not pass the checks, it is never merged to the corresponding branch.&lt;/p&gt;




&lt;p&gt;Cherry-Picking for the win&lt;br&gt;
Any work eventually has to have three PRs. When creating the corresponding staging and develop PRs for any given PR, the process initially was very messy. The commands I was using were git rebase and git merge to get the changes I needed. However any experienced Engineer knows the headaches of constantly resolving merge conflicts.&lt;br&gt;
I stumbled on the git cherry-pick command when talking with a colleague about the issue I was having and he told me put me on. I honestly never felt so much relief. I could now checkout to a new branch from develop and cherry pick the commits from the production PR I had created. Seamless and rarely results in conflicts.&lt;br&gt;
Now it is a daily part of my SDLC.&lt;/p&gt;




&lt;p&gt;Code reviews are necessary&lt;br&gt;
When we began the project, there were only two of us on Frontend. However as the project progressed, more engineers worked on the codebase. It became prudent for us to think about the standards we wanted to enforce within the codebase. Things that were obvious to the two of us initially suddenly was not so obvious for new engineers. &lt;br&gt;
There were cases of duplication of components and logic for things that were already built. Unacceptable of course. &lt;br&gt;
Code reviews for all work became mandatory and this allowed us to catch anti patterns early and ask for changes early in the development lifecycle. &lt;/p&gt;




&lt;p&gt;Cloudflare Preview Links for the win&lt;br&gt;
Cloudflare preview links for all PRs that are pointed to production, develop and staging branches were set up almost a few months into the project. It felt like a brave new world. Fixes and features could be tested directly from preview links without needing to merge to the develop branch. &lt;br&gt;
Eventually the develop branch lost its relevance. We mostly use it now to test out new things but there is no pressure to keep it up to date with Production. &lt;/p&gt;




&lt;p&gt;Final Thoughts&lt;br&gt;
999 PRs may look like just a number, what you don't see is the sleepless nights, rushed deadlines, missed deadlines, painful reverts and digging though endless merge conflicts.&lt;br&gt;
Building out the Performance management module has been a roller coaster. It has been a journey seeing the codebase you built age and having to deal with dependency issues. It opened my eyes to the real world of building and maintaining enterprise software and I will forever be grateful for the lessons learnt.&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
  </channel>
</rss>
