Skip to main content

Module rebase

Module rebase 

Source
Expand description

mkit rebase [-i] <revspec> | --continue | --abort | --skip — replay commits onto a different base. The target is resolved through the shared revspec resolver, so a branch, tag, HEAD~n, or full/short hash all work.

The rebase state machine lives in mkit_core::ops::rebase. This shim loads / writes that state and drives the replay loop via mkit_core::ops::cherry_pick().

With -i/--interactive, the todo list is opened in $EDITOR before any mutation: lines can be reordered, dropped (deleted), reworded, or folded into the previous commit with squash (combine messages) / fixup (keep the previous message). Each commit’s action is persisted alongside todo in the rebase state, so a reword/squash that pauses on conflict still reopens the editor on --continue. A squash/fixup may not be the first line. edit (stop to amend) is not yet supported and is rejected at parse time before HEAD is touched.

On conflict the loop pauses: it materialises conflict material into the worktree + index (via the shared conflict helper) and writes a mkit-conflicts sidecar inside .mkit/rebase-apply/.

--continue does NOT re-run cherry-pick on the paused commit (the #177 bug). Instead it builds the rewritten commit’s tree from the resolved index/worktree, creates the commit, moves todo[0] to done, and keeps replaying the remaining commits.

--skip drops the current todo[0] with no replacement commit and continues. --abort restores HEAD to orig_head and removes all rebase state (including the sidecar).

Functions§

run