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:
develop into mainb-new into developdevelop into main again (where I see old difference and am stuck right now)Thank you.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With