# 致命：不明确的参数 '分支名'：同时是修订版本和文件名

- **ID:** `git/ambiguous-argument-branch-and-path`
- **领域:** git
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

Git 无法确定提供的参数是分支名还是文件路径，因为两者在当前上下文中都存在，导致在 git log 或 git diff 等命令中产生歧义。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| git 2.38.0 | active | — | — |
| git 2.39.2 | active | — | — |
| git 2.40.0 | active | — | — |

## 解决方案

1. ```
   Prefix the argument with '--' to separate revisions from paths: 'git log branch-name -- path/to/file'
   ```
2. ```
   Use 'git rev-parse --verify' to check if the argument is a revision, then explicitly specify with 'refs/heads/branch-name' for branches or './filename' for files
   ```

## 无效尝试

- **** — Renaming the file is a heavy-handed approach that can cause build failures or missing references; the ambiguity is better resolved with syntax. (60% 失败率)
- **** — Deleting a branch is irreversible and may lose work; it's an extreme measure when syntax flags can disambiguate. (75% 失败率)
