{"thread":{"id":"64112","subject":"[UX] git restore -p: confusing prompt after failed hunk edit","startedAt":"2025-09-08T18:11:28Z","lastAt":"2025-09-08T18:11:28Z","messageCount":1,"participants":["Lino Haupt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"525868","messageId":"7123c20f-04c6-47db-a034-a2871721e58f@uni-jena.de","threadId":"64112","inReplyTo":null,"subject":"[UX] git restore -p: confusing prompt after failed hunk edit","fromName":"Lino Haupt","fromEmail":"linojossfidel.haupt@uni-jena.de","sentAt":"2025-09-08T18:02:23Z","receivedAt":"2025-09-08T18:11:28Z","isPatch":false,"sender":{"key":"linojossfidel.haupt@uni-jena.de","avatar":null},"body":"Dear Git developers,\n\nI'd like to report a small UX issue in the interactive patch editor\nused by 'git restore -p' (and, to a lesser extent, 'git add -p').\n\nShort description:\nIf a manual hunk edit fails, Git currently prints:\n   Your edited hunk does not apply. Edit again (saying \"no\"\n   discards!) [y/n]?\n\nThe word \"discard\" here is confusingly close to the normal prompt of\n`git restore -p`:\n   (2/10) Discard this hunk from worktree [y,n,q,a,d,K,j,J,g,/,e,p,?]?\n\nEnvironment:\n- git version: 2.50.1 (NixOS)\n\nReproduction:\n1. Run 'git restore -p' in a repository with unstaged changes.\n2. When shown a hunk, type 'e' to edit the hunk manually.\n3. Make an edit that causes the patch not to apply (e.g., remove\n    required context), then save and exit.\n\nActual behavior:\nGit prints:\n   Your edited hunk does not apply. Edit again (saying \"no\"\n   discards!) [y/n]?\n\nThe normal 'restore -p' prompt uses the same word \"discard\" for the\nhunk itself, e.g.:\n   (2/10) Discard this hunk from worktree [y,n,...]?\n\nWhy this is confusing:\nIn the failure prompt, \"discard\" refers to discarding the edit, while\nin the normal prompt it refers to discarding the hunk. This made me\nhesitate about whether answering 'n' would discard my edit (keeping the\noriginal hunk) or discard the hunk itself.\n\n'git add -p' shows the same failure prompt. Its normal prompt says\n   Stage this hunk [y,n,...]?\nSo the ambiguity is weaker but still present.\n\nSuggestion:\nConsider clarifying the failure prompt.\nAny of the following would remove the ambiguity:\n\nA (minimal change):\n   Your edited hunk does not apply. Edit again (saying \"no\" discards\n   the edit!) [y/n]?\n\nB (explicit menu-style):\n   Your edited hunk does not apply. y: edit again; n: discard the edit\n   [y/n]?\n\nC (shortest, avoids \"discard\" altogether):\n   Your edited hunk does not apply. y: edit again; n: cancel edit [y/n]?\n\nRationale:\nPoint out what exactly is discarded (or cancelled).\nThis makes it explicit what 'n' does and avoids collision with the\nnormal \"Discard this hunk...\" wording in 'git restore -p'. It should\nhelp users who quickly scan prompts.\n\nThanks for all the great work on Git!\n\nBest regards,\nLino Haupt\n\n\n\n\n"}]}