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

Body parameters

Returns

MergeResponse

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 '{}'