When to Merge and When Not To

Merge a branch when it is finished, tested and reviewed; unfinished work that must ship early belongs behind a feature flag, not in a branch that drifts further from main every day. Beware semantic conflicts: if one branch renames a function and another calls the old name, both merge cleanly and the result fails at run time, which is why continuous integration tests the merged code (GitHub). Rather than merging main into a private feature branch to catch up, rebase it (Rebase and Conflicts): merge records history as it happened, rebase rewrites it into a straight line.