Git branching strategy: During git rebase: couple file keeps conflicting

44 views Asked by At

Branching main Branch called MASTER Created a Feature branch called FEATURE_BRANCH from MASTER Created a sub feature branch called SUB_FEATURE_1

FEATURE_BRANCH the parent from which main sun features are created. This branch has to be rebased from MASTER and some features are done.

$ git checkout  FEATURE_BRANCH
$ git rebase master
$ git push origin FEATURE_BRANCH
$ git checkout SUB_FEATURE_1
$ git push origin FEATURE_BRANCH
$ git checkout  FEATURE_BRANCH
$ git commit --amend
$ git push origin FEATURE_BRANCH
$ git checkout SUB_FEATURE_1
$ git rebase FEATURE_BRANCH

On rebasing the sub feature branch there were merge conflicts for file x.txt. So corrected the file git add it and git rebase --continue .

But immediatly, the same file had merge conflicts. I fixed the file again and this time correct it all over again

The same file has the exact same merge conflicts. How is this happening?

IS the branching stategy right ? Why is the file having conflicts again ?

1

There are 1 answers

0
VonC On

First, activate git rerere (as explained here) in order to not have to repeat the conflict resolution you are doing.

But second, and more importantly, do use git rebase --rebase-merges (Git 2.18+)

That way, you won't have to rebase sub_feature_1 branch: only one rebase (of feature_1) will be enough.

git checkout  FEATURE_BRANCH
git rebase --rebase-merges master