Merges are bad only when all parties involved edited the same code. There's no programmatic way to solve this problem. It's an administrative problem: someone has to decide whose code is the right one to use.
If changes coming from both sources are independent, then rebase in Git is trivial as well, and there's nothing to be afraid of.
If changes coming from both sources are independent, then rebase in Git is trivial as well, and there's nothing to be afraid of.