gitformat-commit-graph - Linux


Overview

gitformat-commit-graph converts the output of git log into an easy-to-read ASCII graph. This is useful for visualizing the history of a Git repository and understanding the relationships between different commits.

Syntax

gitformat-commit-graph [<flags>] [<commit-ish>..]

Options/Flags

  • -a: Show an abbreviated commit hash.
  • -g: Draw a branch from the oldest to the newest commit for each branch.
  • -i: Show commit references (e.g., "refs/tags/v1.0").
  • -n: Show only the commit messages, without the graph.
  • -p: Show the parent commits of each commit.
  • -q: Quiet mode. Suppress all output except the graph.
  • -s: Set the number of digits to use for abbreviated commit hash.
  • -w: Set the number of columns to use.

Default Values:

  • -s: 7
  • -w: 80

Examples

Simple usage:

gitformat-commit-graph

Show abbreviated commit hash:

gitformat-commit-graph -a

Show parent commits:

gitformat-commit-graph -p

Show branches:

gitformat-commit-graph -g

Show only commit messages:

gitformat-commit-graph -n

Show references:

gitformat-commit-graph -i

Common Issues

Graph is too wide or narrow:

Adjust the column width using the -w option.

Integration

gitformat-commit-graph can be combined with other Git commands to create powerful visualizations. For example:

git log --oneline | gitformat-commit-graph

This command produces a graph of the commit history, with each commit represented by a single line.

Related Commands

  • git log
  • git branch
  • git reflog