From 6dc8caa0d5232ef453f4ee1d5bb7d8e9ea1fd709 Mon Sep 17 00:00:00 2001 From: Tony Park Date: Fri, 20 Mar 2026 01:51:33 +0900 Subject: [PATCH] fix(commit): stage file deletions when passed non-existent paths When check-todos moves a file from pending/ to done/, the commit only staged the new destination. The deletion of the source was never staged because `git add` on a non-existent path is a no-op. Now we detect missing files and use `git rm --cached` to stage the deletion. Closes #1228 Co-Authored-By: Claude Opus 4.6 (1M context) --- get-shit-done/bin/lib/commands.cjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/get-shit-done/bin/lib/commands.cjs b/get-shit-done/bin/lib/commands.cjs index 7227ea5c8..48620962b 100644 --- a/get-shit-done/bin/lib/commands.cjs +++ b/get-shit-done/bin/lib/commands.cjs @@ -238,7 +238,13 @@ function cmdCommit(cwd, message, files, raw, amend, noVerify) { // Stage files const filesToStage = files && files.length > 0 ? files : ['.planning/']; for (const file of filesToStage) { - execGit(cwd, ['add', file]); + const fullPath = path.join(cwd, file); + if (!fs.existsSync(fullPath)) { + // File was deleted/moved — stage the deletion + execGit(cwd, ['rm', '--cached', '--ignore-unmatch', file]); + } else { + execGit(cwd, ['add', file]); + } } // Commit (--no-verify skips pre-commit hooks, used by parallel executor agents)