/git-graph

Better git graph - zsh plugin

Primary LanguageShellMIT LicenseMIT

git-graph

An out-of-the-box pretty git log --graph.

readme.png

Features

  • Lightweight: Only depends on standard Unix tools.
  • Smart defaults: Colorful, readable graph — no configuration needed.
  • Flexible: Use (almost) any git log option.
  • Autocompletion: Uses git log completions.

Requirements

  • Git
  • Awk
  • Cat
  • tput

Installation

Oh My Zsh

  1. 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"
  1. Add git-graph to your list of plugins in your .zshrc file:
plugins=(... git-graph ...)

Manual install

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'

Usage

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

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

ggb.png

Use (almost) any git log option

gga --since='1 month' --date-order
gga -S 'secret'

Roadmap

  • Add customization capabilities (width, columns, etc.)

License

MIT

Inspirations