From your description, it sounds like you're talking
about including content from one place within another,
not line-level merges between conflicting versions with
a common ancestor.
There are two very common approaches for handling
inclusion: dynamic (e.g.: server side includes or JSP includes),
and static (e.g.: template-driven includes such as you can
achieve via freemarker and/or xslt).
If you go the static approach, then you'd just regenerate
your output as-needed. If you use SSIs, it's all done
automatically, live. The static approach is more scalable
if you've got a huge amount of traffic, but even large sites
use dynamic inclusion fairly often.
I hope this helps,
-Jon