Skip to main content

Module merge

Module merge 

Source
Expand description

mkit merge <branch> | --continue | --abort — merge a branch into HEAD, with a resolvable-conflict workflow (#177).

Behaviour:

  1. Resolve HEAD (ours) and the target ref (theirs).
  2. If equal → “already up to date”.
  3. Find the merge base; if base == ours, fast-forward HEAD to theirs and restore the worktree to theirs’ tree.
  4. Otherwise run a 3-way tree merge. On conflict, materialise the conflict material (markers for text, ours-side for binary/special) into the worktree + index, persist MERGE_HEAD/MERGE_MSG/ ORIG_HEAD and the mkit-conflicts sidecar, and exit non-zero with resolve instructions. The user resolves, mkit adds, then runs mkit merge --continue.
  5. Clean merge: sign a new merge commit with two parents and advance the current branch.

--continue refuses unless MERGE_HEAD exists and no marker-bearing conflicting file remains; it builds the final tree from the resolved index (NOT the conflict-time ours-wins tree). --abort restores HEAD/ref/index/worktree to ORIG_HEAD and clears all state.

Functions§

run