LinuxCommandLibrary

git-column

Format git output into aligned columns

TLDR

Format stdin as multiple columns

$ ls | git column --mode=[column]
copy

Format stdin as multiple columns with a maximum width of 100
$ ls | git column --mode=column --width=[100]
copy

Format stdin as multiple columns with a maximum padding of 30
$ ls | git column --mode=column --padding=[30]
copy

SYNOPSIS

git-column [options] [file...]

PARAMETERS

--command=<name>
    Specifies that git-column was invoked by <name> to format its output. This influences how column options are looked up in the Git configuration.

--[no-]indent
    Pads each column with two spaces. The default is --no-indent.

--[no-]nl
    Ensures the output ends with a newline character. The default is --nl.

--[no-]padding
    Pads each column with a single space. The default is --padding.

--[no-]row-major
    Controls the filling order of columns. With --row-major, data fills rows before columns. The default is --row-major unless otherwise configured.

--[no-]sane
    A convenience option equivalent to specifying --padding --indent --nl --row-major, applying a set of 'sane' default formatting options.

--mode=(dense|long|plain)
    Defines how columns are formatted:
dense: Similar to ls -C, fills columns before rows (column-major).
long: Fills rows before columns (row-major).
plain: Does not use columns, outputs lines as-is.

--width=<width>
    Forces the output width to a specific <width>. By default, it uses the terminal width.

--wrap
    Wraps input lines at the terminal width, useful for very long lines.

--version
    Displays the git-column version information.

--help
    Shows a help message for the command.

DESCRIPTION

git-column is an internal helper command within Git, primarily designed to display textual data in a columnar format. While not intended for direct invocation by end-users, it serves as the underlying engine for many Git commands that produce structured, human-readable output, such as git-branch, git-tag, git-stash list, git-log --graph, and git-shortlog.

The command takes input lines and arranges them into columns based on various formatting modes, including dense (column-major, similar to ls -C), long (row-major), or plain (no columns). It offers options for indentation, padding between columns, and control over whether the output ends with a newline. Users can influence its behavior indirectly through Git's configuration system, specifically via the column.ui and column.<command>.ui settings, which dictate how columnar output should appear for different Git subcommands.

Although not a primary user command, its flexibility in handling columnar display means advanced users or developers might use it directly for testing or custom scripting that requires consistent Git-style columnar output.

CAVEATS

git-column is primarily an internal Git helper command and is not designed for direct end-user interaction. While it can be invoked manually for testing or experimentation, its main purpose is to provide consistent columnar output for other Git subcommands. Its options and behavior are often implicitly controlled by Git's configuration system, rather than direct command-line arguments by the user.

CONFIGURATION

The behavior of git-column can be configured through Git's settings, affecting how various Git commands display columnar output:
column.ui: Defines the default columnar formatting for the user interface. Common values are always, never, or auto, and can also specify modes like dense or long. The default is typically column -x (equivalent to dense mode).
column.<command>.ui: Allows overriding the column.ui setting for specific Git commands. For example, column.branch.ui can be set to control the display of git branch output, independent of other commands.

SEE ALSO

Copied to clipboard