diff --git a/src-tauri/src/git.rs b/src-tauri/src/git.rs index fe3ee72..29f1428 100644 --- a/src-tauri/src/git.rs +++ b/src-tauri/src/git.rs @@ -2615,10 +2615,9 @@ pub fn undo_last_commit(path: String) -> Result { return Err("This is the first commit; there is nothing to undo to.".to_string()); } - // Mixed reset: moves HEAD back one commit and unstages the difference, but - // leaves the working tree files untouched, so the undone commit's changes - // reappear as ordinary uncommitted changes instead of being discarded. - run_git(&repo, ["reset", "HEAD~1"])?; + // Soft reset: moves HEAD back one commit while preserving the index and + // working tree, so the undone commit's changes remain staged. + run_git(&repo, ["reset", "--soft", "HEAD~1"])?; status_for_repo(&repo) } diff --git a/src/App.svelte b/src/App.svelte index 4066aa5..067eef3 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -4719,7 +4719,7 @@ async function undoLastCommitChange() { if (!activeRepoPath || !canAmend || isBusy) return; const confirmed = window.confirm( - "Undo the last commit?\n\nIts changes come back as uncommitted changes in the working tree — nothing is discarded.", + "Undo the last commit?\n\nIts changes remain staged, ready to commit again. Your working tree files are preserved.", ); if (!confirmed) return;