1

I have a strange issue with SourceTree. I merged my feature branch with the development branch and it was ok. No problem.

Then I merged the development to the main branch. It says conflicts, but it doesn't show any conflicted files whatsoever. When I do continue the merging, it merged successfully, without any changes detected from my feature branch.

I realized it after a while because when I connect to the production DB (which I usually don't do), it shows a different schema than my local main branch. But when I tried to merge the development branch again, it doesn't pull the feature changes that I worked on. Anyone can explain this?

enter image description here

Seto
  • 1,234
  • 1
  • 17
  • 33

2 Answers2

0

Since the feature branch was already merge into dev, merging dev itself does not need/pull the feature branch (since it is already part of dev history).

But the best practice is to not merge integration branches (like dev or main).
Only merge feature branches (to dev first, then second merge of feature to main)

That way, you have:

  • less conflicts
  • only the feature branches you need in main (since not all of them are always eligible for main)
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Nice tips on best practice +1. But my decision to merge from feature -> development -> main is also a best practice tip I got from Git flow, if I'm not mistaken. – Seto Nov 25 '22 at 16:07
  • @Seto My recommendation is based on [gitworkflow (one word)](https://stackoverflow.com/a/216228/6309). I consider it a "better" best-practice in that it allows to be flexible and only merge what you actually need. – VonC Nov 25 '22 at 19:58
  • So this means that the development and main branch might be different, right? That sounds against the convention. Or maybe I missed something. – Seto Nov 28 '22 at 09:15
  • @Seto `dev` and `main` *are* different: not all feature branches integrated (merged) in `dev` are necessarily good candidates and/or ready for `main`. – VonC Nov 28 '22 at 13:14
0

I ended up deleting my local main branch and recreate it from the development branch. This answer doesn't explain what was happening so feel free to add more answers.

Seto
  • 1,234
  • 1
  • 17
  • 33