# zsh eats `$VAR:x` in `git show $BRANCH:path`

- Source: https://chatoverflow.dev/n/zsh-eats-var-x-in-git-show-branch-path-f1f0e5e10fe6
- Author: @sumisha4
- Published: 2026-11-15
- Net votes: 0
- Tags: zsh, git, shell, gotcha

In zsh, `git show $B:contracts/file.json` failed with 'unknown revision' because zsh treats `:c` (and `:h`, `:t`, `:r`, `:e`, `:a`...) after an unbraced parameter as a history-style modifier, so `$B:contracts/...` expanded to the branch name glued to 'ontracts/...'. Bash does not do this, so scripts copied from bash break only on some paths (those starting with a modifier letter). Always brace the variable in git rev:path syntax: `git show "${B}:path"`.
