Skip to main content

Practice ยท 2 of 3

Reset Mode Simulator

Model reset as data. State = { commit, staged: [...], worktree: [...] }. Write applyReset(state, mode, n) where n = how many commits to undo: "soft" โ†’ commit moves back n, staged and worktree unchanged; "mixed" โ†’ commit back n, worktree unchanged, staged becomes []; "hard" โ†’ commit back n, staged [], worktree []. Return the new state (do not mutate).

Difficulty: intermediate

Back to lesson: Practice: Recovery Drills โ€” Practice