git-graph
April 12, 2026 · View on GitHub
An out-of-the-box pretty git log --graph.

Features
- Lightweight: Only depends on standard Unix tools.
- Smart defaults: Colorful, readable graph — no configuration needed.
- Flexible: Use (almost) any
git logoption. - Autocompletion: Uses
git logcompletions.
Requirements
- Git
- Awk
- Cat
- tput (optional)
Usage
git-graph
gg
| Alias | Description |
|---|---|
| gg | Show a graph of the current branch. |
| gga | Show a graph of all branches. |
| ggs | Print the last 20 commits across all branches. |
| ggb | Visualize last common commit of diverging branches using git merge-base |
Configuration
Customize the output using the following environment variables.
| Environment variable | Description | Type | Default value |
|---|---|---|---|
GIT_GRAPH_WIDTH | Overall output width | number | Computed with tput |
GIT_GRAPH_AUTHOR_WIDTH | Width for the "author" column | number | 12 |
GIT_GRAPH_DATE_WIDTH | Width for the "date" column | number | 12 |
GIT_GRAPH_DATE_FORMAT | Date format using git's --date syntax. | string | relative |
Examples
Print the last 100 commits across all branches
gga --max-count=100 | cat
Visualize merge-base of HEAD and develop branch
ggb develop HEAD

Custom date format
GIT_GRAPH_DATE_FORMAT=iso GIT_GRAPH_DATE_WIDTH=25 git-graph
GIT_GRAPH_DATE_FORMAT='format:%Y-%m-%d %H:%M' GIT_GRAPH_DATE_WIDTH=16 git-graph
Use (almost) any git log option
gga --since='1 month' --date-order
gga -G 'secret'
Installation
Oh My Zsh
- Clone the repository into your oh-my-zsh custom plugins directory:
git clone "https://github.com/Maks0u/git-graph.git" "${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/git-graph"
- Add
git-graphto your list of plugins in your.zshrcfile:
plugins=(... git-graph ...)
Manual install
You can use the script on its own without installing it as a zsh plugin.
curl --location https://raw.githubusercontent.com/Maks0u/git-graph/refs/heads/main/git-graph.sh --output /usr/local/bin/git-graph
chmod +x /usr/local/bin/git-graph
You'll have to manually define aliases:
alias gg='git-graph'
alias gga='git-graph --all'
alias ggs='git-graph --all --max-count=20 | cat'
Roadmap
- Use
HEADas default when providing a single argument toggb - Column customization
- Column widths
- Toggle columns
- Date format customization
- Two lines format
- Fix format when using
--stat,--compact-summary, etc.
License
Inspirations
- Git Graph extension for Visual Studio Code
- Pretty Git branch graphs (stack overflow)