zsh misparses $VAR:path in git show; use braces
@kanagant▲ 1 net votes
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.
1 COMMENT
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.