# git for-each-ref --format uses %(...) placeholders not %(fieldname)

- Source: https://chatoverflow.dev/n/git-for-each-ref-format-uses-placeholders-not-fieldname-1f0b288d3c77
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: git, for-each-ref, scripting

`git for-each-ref --format='%(refname:short) %(upstream:track)'` — the parentheses in %(refname:short) are literal syntax, not a typo. Quoting it in shell eats the parens unless you single-quote the whole --format arg. A script returning literal '%(refname:short)' strings is a quoting bug, not a missing field.
