Note that there are some explanatory texts on larger screens.

plurals
  1. POGit strategy for merging to a Prod branch from two different code lines (regular release branch and a hotfix branch)
    primarykey
    data
    text
    <p>Our long running git branches are <strong>Master</strong>, <strong>UAT</strong>, and <strong>Prod</strong> such that new functionality is worked on and committed initially to Master, promoted to UAT (when ready for UAT) then promoted to Prod (when ready for Production). We now need the ability to create hotfixes in production. We are planning to create a <strong>Hotfix</strong> branch that links up with the <strong>Prod</strong> branch. In addition to being long running, these branches are separate from each other in that merges are done using "non-fast-forward" merges to keep the branches separate (so that we can see easily what activity has happened on each branch, e.g. a code promotion from Master to UAT, etc). </p> <p>The following shows the flow of commits for one regular development release which ended up needing a hotfix. Master has the majority of commits as development is happening all the time. UAT and Prod only have commits that represent code promotions. When a hotfix is needed, we merge from prod to hotfix, make the change on the hotfix branch, test it in a hotfix environment, then merge it into prod. </p> <pre><code>hotfix ----------------------o-o---------- [1 commit for the merge prod-&gt;hotfix to get the latest state of prod into the hotfix environment, 1 commit of a bugfix to the hotfix environment] prod --------------------o-----o-------- [1 commit for the promotion uat-&gt; prod to get the latest uat-tested code into prod, 1 commit for the promotion of the bugfix hotfix-&gt;prod] uat -----------------o----------------- [1 commit for the promotion of master-&gt;uat of 4 master commits] master --o---o---o---o----o-o--o---o-o--o- [10 commits of new functionality] </code></pre> <p>Note after a hotfix, the hotfix change is manually incorporated into the master branch. This is because depending on the time the hotfix went out and the state of the current development line (it could be months later), the code could be too divergent between Master and Hotfix, and an automatic merge from Hotfix to Master may not make sense. Because of this, for the merge from UAT to PROD, from PROD to HOTFIX, and from HOTFIX to PROD, we will be NOT be doing a regular git merge, but will instead use the <strong>git merge -s theirs strategy</strong> as documented here: <a href="https://stackoverflow.com/questions/4911794/git-command-for-making-one-branch-like-another/4912267#4912267">git command for making one branch like another</a> (We will specifically be doing simulation #3). </p> <p>What this strategy does is say "please merge in all changes from upstream into downstream and wipe out the state of downstream and replace it with exactly what is coming from the upstream". So when we go from UAT to PROD using this strategy we basically say "make PROD look EXACTLY like UAT". This ensures that what gets into Production is exactly the state of the code that was in UAT. </p> <p><strong>Is the git merge -s theirs strategy the right way to do this sort of a merge strategy when you have two branches bringing in changes into production (one for regular releases and one for hotfixes) like this?</strong></p> <p>If we had no hotfix branch, we would simply do a regular (non-fast-forward) merge from master to uat to prod and not use the git merge -s theirs strategy, as it would not be needed.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload