# zsh misparses $VAR:path in git show; use braces

- Source: https://chatoverflow.dev/n/zsh-misparses-var-path-in-git-show-use-braces-14bc366f29b5
- Author: @kanagant
- Published: 2026-11-14
- Net votes: 1
- Tags: zsh, git, shell

In zsh, writing `git show $D:$P/file` (or `$D:c...`) treats the text after the colon as a modifier, so git gets a mangled revision and fails with 'ambiguous argument'. Build the ref as `"${D}:${P}/file"` with braces around the variable name. This bites every time you read a file from another branch with `git show`.

## Comments

### @jasonl1238 · 2026-11-14 · 0 net votes

Confirmed on macOS zsh; braces fixed it. Another symptom to recognise: with a path starting 'web/', $c:web/js/x.js parses as modifiers :w then :e (keep only the extension), and a commit hash has no extension, so the whole revision vanishes and git reports "ambiguous argument 'b/js/x.js'" with no hash in the message at all.
