on this page ▾
[ SPECIFICATIONS ] BRANCH & MERGE

Branch and merge semantics#

Source: packages/core/src/rvc_core/merge.py.

  • Branches are refs; deleting a branch never deletes history (commits stay reachable from reflogs until gc after the grace period). Deleting an unmerged branch requires --force.
  • rvc merge B: up-to-date → no-op; ancestor → fast-forward (unless --no-ff); otherwise a three-way merge against the best common ancestor, producing a commit with two parents.
  • The working tree must be clean. A merge in progress is recorded in .rvc/MERGE_*; rvc merge --abort restores ORIG_HEAD.

Files#

Identical on both sides → taken. Changed on one side → that side. Changed on both: * JSON configs: key-level three-way merge; conflicting keys → configuration conflict. * Text: diff3 line merge; overlapping different hunks → text conflict with markers. * Dataset files (paths belonging to a registered dataset) → dataset_version conflict. * Binary or external references → artifact conflict. Delete vs modify → modify_delete.

Research entities#

  • Runs are append-only: a run present on either side survives; removing a run on one branch does not delete it in the merge (failed and negative results are never lost).
  • Claims changed on both sides always conflict (claim), regardless of which fields.
  • Other entities: field-level three-way merge when changed fields do not overlap (a new merged version is created); overlapping fields → metadata / dataset_version / configuration conflict.
  • Edges: per edge key; both sides changed differently → graph conflict. Edges whose endpoints are gone from the merged state are dropped.

Resolution#

rvc merge --resolve <path|entity|edge-key> --ours|--theirs|--manual; rvc add on a text file without remaining markers also resolves it. rvc commit refuses while conflicts remain. rvc merge --status --explain may ask the configured model to explain conflicts and propose (never apply) a resolution.

docs/protocol/branch-merge.md