Progress:
TIER 2 · MODULE 44· Intermediate

git column

Internal formatter. Used by ls-files and friends.

🎯 What & why

Internal column formatter Git uses to lay out lists like branch, tag, status -s, and ls-files in tidy multi-column blocks. You rarely call it directly, but knowing it explains why those commands suddenly stop columnizing in pipes.

🧠 Mental model

A pure text reformatter: read lines on stdin, emit a column-packed layout on stdout, sized to the terminal width. The 'auto' mode is the default everywhere — it activates only on a TTY, which is why git branch | cat looks single-column.

🛠️ Synopsis

git column [--command=<name>] [--mode=<mode>] [--raw-mode=<n>]
           [--width=<width>] [--indent=<string>] [--nl=<string>]
           [--padding=<n>]

Reads lines from stdin and writes a columnar layout to stdout.
--command=<name> lets it consult column.<name> / column.ui config so
callers like 'git branch' get consistent behavior. Most users meet it
indirectly via the column.ui or column.<command> settings.

🎚️ Switches & options

FlagWhat it does
--mode=<mode>Layout choice: 'always' (force columns), 'auto' (only on TTY), 'never'/'plain' (one per line), plus 'column' (fill columns first), 'row' (fill rows first), 'dense'/'nodense' (variable vs. fixed column widths).
--raw-mode=<n>Set the layout mode by integer bitmask instead of a name. For scripts that already speak Git's internal flag values; prefer --mode for sanity.
--width=<n>Override terminal width. Defaults to COLUMNS, then ioctl, then 80. Useful when piping for a known target (e.g., a fixed-width log).
--indent=<str>String prepended to each output line. Handy for embedding columnized output under a heading.
--nl=<str>String appended to each line in place of a plain newline. Lets you stitch the output into other formats.
--padding=<n>Spaces between columns. Default 1; bump it when entries are visually dense.

💡 Use cases

🧪 Examples

Columnize stdin in dense mode
ls | git column --mode=dense
Force a 120-col layout
git ls-files | git column --mode=always --width=120
Add an indent
git tag | git column --mode=always --indent='    '
Configure git branch to always columnize
git config --global column.branch always

🎓 Recommendations

🪤 Common pitfalls

🔗 Related modules

📝 Quiz

Hit each option, then Check answers. Score is recorded; Next is always open.