git
runtime_error
ai_generated
true
错误:您对以下文件的本地更改将被合并覆盖: file.txt 请在合并之前提交您的更改或将其 stash。
error: Your local changes to the following files would be overwritten by merge: file.txt Please commit your changes or stash them before you merge.
ID: git/stash-conflict-on-pop
85%修复率
85%置信度
1证据数
2023-08-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| git 2.20 | active | — | — | — |
| git 2.35 | active | — | — | — |
| git 2.42 | active | — | — | — |
根因分析
在工作目录有未提交的更改且与 stash 中的更改冲突时运行 'git stash pop'。
English
Running 'git stash pop' when the working directory has uncommitted changes that conflict with the stashed changes.
官方文档
https://git-scm.com/docs/git-stash#Documentation/git-stash.txt-pop解决方案
-
First, commit or stash the local changes: git stash push -m 'temp' (or git commit -m 'temp'). Then pop the original stash: git stash pop stash@{1} (adjust index). Finally, restore the temporary stash if needed: git stash pop stash@{0}. -
Use 'git stash branch' to create a new branch from the stash, which avoids conflicts: git stash branch new-branch stash@{0}
无效尝试
常见但无效的做法:
-
100% 失败
Git stash does not have a force option; the error persists because the conflict is not resolved.
-
50% 失败
This loses the local changes permanently without any recovery option.