# 错误：您对以下文件的本地更改将被合并覆盖：file.txt 请在合并之前提交更改或将其暂存。

- **ID:** `git/merge-branch-refused-due-to-uncommitted-changes`
- **领域:** git
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

工作目录中的未提交更改与传入的合并更改冲突，Git 拒绝继续以防止数据丢失。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| git 2.28.0 | active | — | — |
| git 2.34.0 | active | — | — |
| git 2.41.0 | active | — | — |

## 解决方案

1. ```
   Stash your changes: git stash push -m 'temp stash', then merge, then apply stash: git stash pop
   ```
2. ```
   Commit your changes: git add file.txt && git commit -m 'save local changes', then merge.
   ```
3. ```
   If the changes are not needed, discard them: git checkout -- file.txt, then merge.
   ```

## 无效尝试

- **** — Permanently discards all local changes, which may be unintended. (60% 失败率)
- **** — Wipes all uncommitted changes, including those in other files. (70% 失败率)
- **** — Does not bypass the error; the merge still refuses to proceed. (100% 失败率)
