# fatal: ambiguous argument 'branch-name': both revision and filename

- **ID:** `git/ambiguous-argument-branch-and-path`
- **Domain:** git
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Git cannot determine whether the provided argument refers to a branch name or a file path because both exist in the current context, causing ambiguity in commands like git log or git diff.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| git 2.38.0 | active | — | — |
| git 2.39.2 | active | — | — |
| git 2.40.0 | active | — | — |

## Workarounds

1. **Prefix the argument with '--' to separate revisions from paths: 'git log branch-name -- path/to/file'** (95% success)
   ```
   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** (88% success)
   ```
   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
   ```

## Dead Ends

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