1

I need to better understanding the branches merge procedure.

Following the next design:

enter image description here

It could be any lost of code or at the end the branch will have all the commits?

From my point of view not, the commits have each one its unique hash to be identified but we have had experienced at some moment some lost of code instead conflicts to resolve and we are not sure what we did wrong in the past and we don't want that happens again.

I'll appreciate clarifications.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
manou
  • 123
  • 2
  • 20

1 Answers1

1

we have had experienced at some moment some lost of code instead conflicts to resolve

Conflicts occurs only if there are concurrent changes since the last merge-base.
If changes occurs (since the last merge) only on one branch, merging that branch to its destination branch will result in overriding the destination branch content with the source branch content.

Try and remake those problematic merges with:

git config merge.conflictStyle  diff3

That way, you will see the common ancestor as well as the source and destination code conflict.
See this merge conflict example.

Note also that merging C to B does not mean the HEAD of branches A, B and C are equals like the (branch C(=A=B) could imply): B remains at c8, C has one merge commit (result of the merge), and A has not moved.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250