Merge one entity from one branch into another
POST /Platform/entities/{entity_type}/{entity_id}/merge
Merge one entity from one branch into another. A three-way merge.
Unlike fast-forward (which refuses when both branches moved),
this finds the nearest common ancestor commit and merges the two
sides structurally: per-field for nested dicts, per-item for
id-keyed lists (e.g. form fields), and line-level (diff3) inside
multi-line text. Compatible changes — different fields, different
list items, different regions of the same document — merge
automatically; only the same thing changed differently on both
sides is a conflict.
Outcomes (status): up_to_date (nothing to do),
fast_forwarded (to_branch had no independent commits, pointer
moved), merged (merge commit stored on to_branch with both
heads as parents), or conflicts.
On conflicts NOTHING is written; each conflict carries a
path plus the base/ours/theirs values (ours =
to_branch, theirs = from_branch). Resolve by re-calling
with resolutions, e.g.
{"/status": "theirs", "/fields/id=item_1/label": {"value": "X"}}.
The merged result is validated before storing — a merge can never
persist an entity that fails validation. Use dry_run=true to
preview the outcome (including conflicts) without writing.
NESTED ENTITIES merge per entity: the parent's YAML holds child
REFERENCES ({entity_type, id}), so merging a parent covers ref
swaps and list membership but never child content — merge (or
fast-forward) each edited child separately. A child created only on
from_branch must be promoted too, or the merged parent's ref
won't resolve on to_branch.
A lines-typed field merges line-by-line (diff3), whether serialized as one text block or a list of blocks/images — edits to different sections of the same document merge cleanly.
Path parameters
entity_type: str. Entity class name.entity_id: str. Entity id to merge.
Body parameters
from_branch: str. Branch to merge from (e.g.dev).to_branch: optional str. Branch to merge into (defaultmain).resolutions: optional dict. Conflict resolutions keyed by conflict path; each value is"ours","theirs","base", or{"value": <explicit value>}.dry_run: optional bool. If True, compute the merge (and conflicts) but never write.include_diff: optional bool. If True (default), include a unified diff of what the merge changes onto_branch.commit_message: optional str. Optional message for the merge commit.
Returns
MergeResponse
entity_type: optional str or null. Entity class name.entity_id: optional str or null. Entity id.from_branch: optional str or null. Branch merged from.to_branch: optional str or null. Branch merged into.status: optional str or null. merged, fast_forwarded, up_to_date or conflicts.dry_run: optional bool. True when nothing was written.base_commit_id: optional str or null. Nearest common ancestor commit, when a merge ran.commit_id: optional str or null. New head of to_branch.conflicts: optional List[dict]. One per conflict: path, reason, base, ours (to_branch), theirs (from_branch). Nothing is written while any remain.diff: optional str or null. Unified diff of what the merge changes on to_branch.
Example request
curl -X POST "https://api.hilus.ai/Platform/entities/{entity_type}/{entity_id}/merge" \
-H "Authorization: Bearer $HILUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'