0

I have two branches: qa and prd. Initially they are completely the same (qa is based on prd).

Step 1: A creates a feature branch f1 from prd. A completes development.

Step 2: A merges f1 into qa for testing. Done.

Step 3: A merges f1 into prd.

Now I want to make qa and prd equal again (they seem to be equal from human's perspective but git refuses to recognize as equal because the two merges are separate, this is one thing I think git doesn't really fit our purpose), so:

Step 4: A merges prd into qa.

Step 5: A creates a second feature branch f2 from prd. A completes development.

Step 6: A tries to merge f2 into qa but sees a conflict.

Question: I would like to avoid the conflict in Step 6. I have other restrictions:

  • I cannot promote changes by merging qa into prd;
  • I cannot use cherry pick;
  • I can accept any answer that can be automated through GitHub Action
  • I must preserve history of qa (is it even possible?)

All these restrictions might sound strange to you but it is out of my ability to change them.

I did a bit of research and looks like a hard reset of qa to prd makes them TRULY equal (in git's perspective) , but this loses all history of qa. Is there any way to force git to think that they are equal without losing history? Again I'm beginning to think that git doesn't really fit our purposes and I'm trying to shoe-hone it.

There is also a post that looks to be helpful but I'm not 100% sure: Making two branches identical

  • 1
    I believe you should not merge `f1` into `prd` directly, but rather merge `qa` into `prd`. – Peter Krebs Jul 22 '22 at 13:19
  • Hi @PeterKrebs thanks, yeah I understand that will prevent the conflict from occuring. However, I cannot do that because `qa` is a volatile sandbox branch. We actually don't do any test in `qa` so maybe `sandbox` is a better name. – Marcus Anthony Jul 22 '22 at 13:57
  • 2
    In that case I would treat `qa` as a second class citizen and force-push to it, simply overwriting it? It's more like `qa` is there because you don't have a pipeline set up. – Peter Krebs Jul 22 '22 at 14:34

0 Answers0