Skip to main content

Module reset

Module reset 

Source
Expand description

mkit reset [--soft|--mixed] [<commit>] — move the current branch (or detached HEAD) to <commit>, optionally resetting the index.

Two modes, mirroring git reset’s safe subset:

  • --soft — move HEAD / the current branch only. The index and the worktree are left exactly as they are, so the difference between the old tip and the new target shows up as staged changes.
  • --mixed (the default) — move HEAD and rewrite .mkit/index to mirror the target commit’s tree. The worktree is untouched, so changes relative to the target appear as un-staged worktree edits.

<commit> defaults to HEAD (a no-op move that still re-syncs the index under --mixed) and is resolved through the shared revspec resolver, so a branch, tag, HEAD, full/short hash, or HEAD~n/^ navigation all work.

  • --hard — move HEAD, reset the index to the target tree, AND reset the worktree to it (discarding tracked-file changes). Like git, untracked files are left in place. This is the one destructive variant, so it runs the same dirty/untracked guard as checkout (#176): it refuses to discard locally-modified or staged content unless -f/--force is given. That guard is an mkit safety divergence — git’s reset --hard discards silently.

Functions§

run