column Git Command Guide
The git column command formats and displays data in multiple columns, making output from other Git commands more readable by organizing it neatly.
git column Syntax:
Section titled “git column Syntax:”git column [<options>] [-- <command>]Options:
Section titled “Options:”| Option | Description |
|---|---|
| —mode= | Select the terminal-wide part of the width to use |
| —raw-mode= | Same as —mode but does not assume terminal width |
| —padding= | Determine padding between columns |
| —indent= | Add string to the beginning of each line |
| —width= | Specify terminal width (overrides autodetection) |
| —table | Prefix each column with a table-like header |
| —table-columns= | Specify column names for table headers |
| —column | Prefix each column with column number and header |
| —column-columns= | Specify column names when using —column |
| —line | Same as —column but without column numbers |
| —line-columns= | Specify column names when using —line |
| -n, —no-headers | Do not print headers |
| —help, -h | Display help |
Parameters:
Section titled “Parameters:”| Parameter | Description |
|---|---|
| Command whose output should be formatted |
git column Command Samples:
Section titled “git column Command Samples:”Format branch list in columns
Section titled “Format branch list in columns”git branch --format='%(refname:short)' | git column --mode=columnDisplays Git branches in organized columns.
Show branches with table headers
Section titled “Show branches with table headers”git branch --format='%(refname:short)%00%(objectname:short)' | git column --table --table-columns='Branch,SHA'Creates a table format with headers.
Display tags in columns
Section titled “Display tags in columns”git tag --sort=-creatordate | git column --mode=columnShows tags sorted by creation date in columns.
Format with custom padding
Section titled “Format with custom padding”echo -e "item1\\titem2\\nitem3\\titem4" | git column --padding=3Shows items with 3 spaces padding between columns.
Use with for-each-ref
Section titled “Use with for-each-ref”git for-each-ref --format='%(refname:short)%00%(authorname)%00%(subject)' refs/heads | git column --mode=column --table --table-columns='Branch,Author,Subject'Creates a table showing branches with author and subject.
How do I display Git branches in columns?
Section titled “How do I display Git branches in columns?”To display Git branches in columns, use:
git branch | git column --mode=columnHow can I create a table with git column?
Section titled “How can I create a table with git column?”To create a table with git column, execute:
<command> | git column --table --table-columns='<headers>'How do I adjust column padding?
Section titled “How do I adjust column padding?”To adjust column padding, run:
<command> | git column --padding=<number>How can I format output without headers?
Section titled “How can I format output without headers?”To format output without headers, use:
<command> | git column --no-headersHow do I use git column with for-each-ref?
Section titled “How do I use git column with for-each-ref?”To use git column with for-each-ref, run:
git for-each-ref --format='...' | git column --mode=columnApplications of the git column command
Section titled “Applications of the git column command”- Formatting branch lists for better readability in terminals
- Creating table-like displays of repository references
- Organizing output from commands like git tag and git branch
- Presenting structured data in CI/CD pipeline outputs
- Enhancing visual organization of Git command results
- Supporting scripts that need formatted columnar display