I have merged a develop branch into main branch using squash merge. Let's say there are commit A, B, C merged into main from develop. The changes are successfully merged. I can see the squash commit on the main branch and the files are updated.
After that, I created a new branch (b-new) from develop and merged it into develop. However, When I try to sync main with develop again, I can still see the old differences (commit A, B, C). How to resolve this issue?
To clean up:
- PR #1: merge commit A, B, C from
developintomain - PR #2: merge
b-newintodevelop - PR #3: merge
developintomainagain (where I see old difference and am stuck right now) - I am not able to directly push changes to main without 1 approval
- The changes will not affect others, so don't need to worry about it.
Thank you.
CodePudding user response:
This scenario, where you have two long-running branches and are using squash merges, is described in the Git FAQ in some detail. Roughly, the answer is that you are bound for a world of pain if you use squash merges with two long-lived branches and there's no way to avoid it.
If develop is intended to be a feature branch, then to avoid seeing those commits, you should recreate it off of main each time, either by deleting it first, or by using git checkout -B develop main. If develop is intended to be a long-running branch along with main, then you need to not use squash merges.
