github / github/copilot-cli

Feature Request: Selective per-file accept/revert for Copilot CLI agent changes like `git add -p`

未關閉
#3,640 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:sessions area:tools
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the feature or problem you'd like to solve

After Copilot CLI applies file changes in a turn, the only recovery option is `/rewind` which reverts **everything** in that turn. There is no way to selectively keep some file changes while discarding others.

### Proposed solution

1. **post-apply interactive review**: After a turn completes, offer a `/review-changes` command that lists modified files and lets you revert selected ones
2. **`/rewind --file `**: Extend `/rewind` to accept a file path argument
3. **Plan mode enhancement**: In plan mode, show actual code diffs (not just natural language descriptions) before execution, with per-file approval
4. **VS Code `/ide` integration**: When connected via `/ide`, route file-level accept/discard through VS Code's native diff editor

Any of these would be a significant improvement over the current all or nothing model

### Example prompts or workflows

After a turn applies file changes, users should be able to selectively accept or revert on a **per-file** basis and ideally **per chunk** within a file similar to `git add -p`.

Something like:

Copilot modified 5 files. Review changes?
[1] src/auth.ts - 12 lines changed [keep/revert]
[2] src/config.ts - 4 lines changed [keep/revert]
[3] tests/auth.test.ts - 28 lines changed [keep/revert]

### Additional context

### Problems

| Mechanism | Granularity | Limitation |
|---|---|---|
| Write permission prompt | Per write-call | Binary yes/no; one call can touch many files |
| `/diff` | Read-only, post-apply | Shows changes but cannot act on them |
| `/rewind` | Entire turn | All-or-nothing cannot keep partial changes |

`/rewind` is a blunt instrument - it treats a multi-file turn as atomic. Real-world agent tasks often span several files, and it's common for most changes to be correct while one file went in an unintended direction. Forcing an all-or-nothing revert actively works against iterative, confident use of the agent.

貢獻指南

開啟貢獻指南

研究方向

先追蹤現有的 /rewind 和 /diff 指令流程,以及 issue 中描述的 /ide 整合。釐清哪個提案屬於範圍內,接著以在一次涉及多個檔案的操作後,能夠在檔案或 chunk 粒度上選擇性地保留或還原變更為完成標準,並搭配適當的 review 或整合測試。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git, shell, vscode
領域
cli, developer-experience
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
冷清
描述清晰度
需要釐清
新手友好度
32/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。