git-commit-graph - Linux


Overview

git-commit-graph is a visual representation utility for Git repositories. It generates an ASCII graph of commit history, making it easy to visualize project evolution, spot patterns, and identify points of divergence.

Syntax

git commit-graph [options] [<begin> <end>]

Options/Flags

  • –stat-width: Set the width of the statistics columns.
  • –font or -f: Specify a MapFont file.
  • –numstat-width: Set the width of the numbers column.
  • –display-refs: Display references in the commit graph.
  • –all: Show all commits, not just those reachable from the current HEAD.
  • –graph: Generate an ASCII graph of the commit history.
  • –topo-order: Order the commits topologically.
  • –pretty: Set the output format for commits.
  • –commit-summary: Show summary of each commit.
  • –commit-info: Show more details for each commit.
  • –dense: Use a dense commit history representation.

Examples

Generate a basic commit graph:

git commit-graph

View all commits with detailed information:

git commit-graph --all --commit-info

Compare two commits:

git commit-graph commit1^..commit1

Show a specific range of commits:

git commit-graph v1.0..v2.0

Common Issues

  • Error: "unknown refspec": Make sure the specified commit range exists in the repository.
  • Graph is too large: Use --max-count to limit the number of commits displayed.
  • Commits are not in topological order: Use --topo-order option to sort commits topologically.

Integration

git-commit-graph can be integrated with other Git commands to facilitate various tasks:

  • git log --graph: Generate a textual commit graph.
  • git diff --graph: Visualize code changes between two commits.
  • git filter-branch --graph: Filter and modify the commit history.

Related Commands

  • git log: Show a log of commits.
  • git show: Display commit details.
  • git diff: Compare changes between commits.