An interactive, GitLab-style commit graph for any git repository, one command away.
cd any/repo
gitgraph # or: git graphA window opens with the whole history: colored branch lanes, merge curves, branch and tag
labels, a date column, and the full commit message when you hover a commit dot. It works the
same for GitHub, GitLab or purely local repositories, because it only reads the local .git
and never runs git commands against a remote (in partial clones it lists changed files without line
counts rather than downloading file contents; with git older than 2.44 git itself may still fetch
them). The only network access is for author pictures, see below.
▶ Watch the demo with sound (MP4, 1080p)
- GitLab network-graph look, modernized: one row per commit, colored lanes that keep their color, smooth merge curves, a month/day column, a header naming every column, avatars.
- Branch and tag labels next to the graph, like GitLab: right-aligned in their own column
with an arrow to their commit, in the branch's color (local and remote alike), so they stay
visible however long the commit message is. A local branch and its remote copy on the same
commit (
main+origin/main) are one label with a cloud mark; when they differ, each sits on its own commit. - Hover a dot for author, date, full SHA, refs and the complete commit message.
- Click a commit for a details panel: full message, author and committer, parents and
children (clickable), changed files with
+/-counts. - Fast on big histories:
git logis streamed into the page, the layout is incremental and only the visible rows are drawn. git/git (86k commits, 282 lanes) shows its first screen right away and is fully laid out in about 2.5 s, most of it spent insidegit logitself. Beyond 200k commits the rest loads as you scroll. - Live: commit, fetch or switch branches in a terminal and the graph refreshes by itself, keeping your position.
- Filters: all branches and tags, local branches only, the current branch, or any single branch, remote branch or tag. Toggle remotes and tags. Date order (like GitLab) or topological order (fewer crossings).
- Search commit subjects, authors, e-mails, SHA prefixes and ref names;
Enter/Shift+Enterto jump between matches. - Keyboard:
↑ ↓/j kmove,Enterdetails,p/cparent / child,hHEAD,ycopy SHA,/search,← →scroll the graph sideways,?all shortcuts. - Light and dark theme (follows the system, toggle in the toolbar).
- Author pictures from the repository's GitHub or GitLab host, with no setup (see below); coloured initials otherwise.
- No dependencies: just Python ≥ 3.8 and git. Opens a chromeless app window when Chrome, Edge, Brave, Chromium or Vivaldi is installed, otherwise a normal browser tab.
Windows, Linux and macOS, with Python 3.8+ and git 2.24+. CI runs the whole test suite on all three (oldest available Python, 3.9 or 3.10, and 3.13) on every push and pull request, including a UI suite that drives headless Chrome through every feature, and each release is checked on a large real history (git/git). Linux and Windows were also verified by hand (see TESTING.md).
| App window | Notes | |
|---|---|---|
| macOS | Chrome, Edge, Brave, Chromium, Vivaldi | otherwise the default browser |
| Windows | Edge (always present), Chrome, Brave | git calls run without console windows |
| Linux | google-chrome, chromium, microsoft-edge, brave, vivaldi | snap browsers get the one-time link instead of the private launch file |
You need git and Python 3.8 or newer (python3 --version). gitgraph has no other
dependencies. Install it with pipx, which puts command line tools in
their own environment and on your PATH:
pipx install git+https://github.com/edoardopanichi/gitgraph.git
gitgraph --versionNo pipx yet?
| System | Install pipx |
|---|---|
| macOS | brew install pipx && pipx ensurepath |
| Ubuntu / Debian | sudo apt install pipx && pipx ensurepath |
| Fedora | sudo dnf install pipx && pipx ensurepath |
| Windows | py -m pip install --user pipx then py -m pipx ensurepath |
Open a new terminal after pipx ensurepath. (Plain pip install git+https://... works too,
but recent Linux distributions and Homebrew refuse to install into the system Python.)
This installs two commands, gitgraph and git-graph; git picks up the second one, so
git graph works too.
pipx upgrade gitgraphThis installs the newest release from main; it does nothing until a new version is out (see
CHANGELOG.md). A specific release, a branch or a local clone:
pipx install --force git+https://github.com/edoardopanichi/gitgraph.git@v1.1.5
pipx install --force git+https://github.com/edoardopanichi/gitgraph.git@<branch>
pipx install --force /path/to/your/clonepipx uninstall gitgraphgitgraph also keeps a cache (author pictures and the app window's browser profile) that you can
delete: ~/Library/Caches/gitgraph (macOS), ~/.cache/gitgraph (Linux),
%LOCALAPPDATA%\gitgraph (Windows).
gitgraph [PATH] [options]
PATH repository or any folder inside it (default: .)
-o, --order {date,topo} commit order (default: date, like GitLab)
-s, --scope {all,local,head}
refs to draw: all (default), local branches, or HEAD only
--no-remotes hide remote-tracking branches
--no-tags hide tags
-n, --max-count N show at most N commits
--tab open a normal browser tab instead of an app window
--no-avatars initials only: never contact GitHub/GitLab for pictures
--no-open only print the URL and serve until Ctrl+C
-d, --detach run in the background and give the terminal back
-p, --port PORT port to listen on (default: random)
--verbose log HTTP requests (not with --detach)
-v, --version print the version
gitgraph stays in the terminal you start it from while its window is open: closing the window
or pressing Ctrl+C there ends it. With --detach it runs in the background instead (on Windows
without any console window) and exits a few seconds after the last window closes. In --tab
mode a tab whose connection drops without closing (for example one the browser put to sleep)
keeps the server around for 30 minutes so the tab still works when you come back.
On Linux without a display (an SSH session, a headless server) it opens nothing: it prints the
URL and serves until Ctrl+C, as with --no-open (forward the port with ssh -L and -p).
Environment variables:
| Variable | Effect |
|---|---|
GITGRAPH_BROWSER |
Browser executable (name or path) to use for the app window. |
GITGRAPH_STARTUP_TIMEOUT |
Seconds the background server waits for a window to connect (default 60). |
GITGRAPH_NO_AVATARS |
Any value: same as --no-avatars. |
GITGRAPH_DEBUG |
Any value: print why author pictures could not be found. |
When the origin remote is on GitHub or GitLab (gitlab.com or self-hosted), commits show their
authors' profile pictures. Nothing to configure:
- GitHub:
…@users.noreply.github.comemails map directly to a picture. Other emails are looked up once through GitHub's public API (60 lookups/hour without a token; ifGITHUB_TOKEN,GH_TOKENor a logged-inghCLI is already there, it is used, which also covers private repositories). - GitLab: GitLab is asked who wrote each author's commit, so the commit email is matched
against all of the user's verified emails, like on GitLab's own pages. The commit asked about
is the author's newest pushed commit (GitLab can't know local-only commits); your own
picture comes straight from your GitLab profile (any verified email). Public projects need
nothing. Private projects need a token (an SSH key is not enough: it only works for git,
not for GitLab's API):
GITLAB_TOKENwith theread_apiscope, or aglab auth loginfor that server, are used when already there (GITLAB_TOKENonly whenGITLAB_HOSTis unset or names the repository's server). Without one, GitLab's public lookup is used, which only finds authors whose public email in their GitLab profile is the one they commit with. Pictures that GitLab would take from Gravatar are ignored; only pictures uploaded to the GitLab instance are shown. - Other hosts, no picture, offline, rate limits: the coloured initials (when the host could not be reached, the page asks again a couple of minutes later). No other service is ever contacted, and the page itself never talks to the internet (pictures go through the local server).
- Pictures are cached for 7 days ("no picture" for 1 day, but asked again at once after you
log in with
gh/glabor set a token) in the cache folder (~/Library/Caches/gitgraph,~/.cache/gitgraph,%LOCALAPPDATA%\gitgraph). The cache is capped at 20 MB (least recently used pictures go first), each picture at 512 KB, and one run makes at most 300 lookups, so a repository with thousands of contributors can't download much. - Lookups send commit ids and authors' email addresses to the repository's own host, and a
token only to that host. Use
--no-avatarsto turn the feature off.
gitgraph: command not found(orgit: 'graph' is not a git command): pipx's folder is not on yourPATHyet. Runpipx ensurepathand open a new terminal.- It opens a browser tab instead of a window: gitgraph found no Chrome, Edge, Brave,
Chromium or Vivaldi. Point it at one with
GITGRAPH_BROWSER=/path/to/browser, or keep the tab. - Over SSH or on a server without a display: gitgraph prints the URL and keeps serving. Pick
a port and forward it:
gitgraph -p 8765there,ssh -L 8765:127.0.0.1:8765 hosthere, then open the printed URL locally. - Initials instead of author pictures: run
GITGRAPH_DEBUG=1 gitgraph(PowerShell:$env:GITGRAPH_DEBUG=1; gitgraph) to see why each lookup failed. Common reasons: the email is not linked to a GitHub/GitLab account, a private repository without a token, or the GitHub rate limit for anonymous lookups. See Author pictures. - Changed files listed without
+/-counts: the repository is a partial (blobless) clone and the file contents are not on your machine; gitgraph never downloads them. - Slow first screen on a very large repository:
git commit-graph write --reachable(or a recentgit gc) makes it appear much sooner. - Something else: open an issue with
gitgraph --version,git --version, your OS and what happened.
python -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest # everything below
node --test tests/js/*.test.js # JavaScript layout tests onlytests/test_gitdata.py,test_server.py,test_cli.py: git access, HTTP API, security checks, server lifetime, detached launch.tests/js/: layout invariants on hundreds of randomized histories (needs Node.js).tests/test_large_repo.py: the standard large-repository check, opt-in withpytest -m large(clones git/git, ~86k commits, and drives every feature with timings).tests/test_ui.py: drives headless Chrome (needs Node.js >= 20 and a Chromium browser) through load, hover, details, search, help, theme, keyboard and filters at three window sizes, and runs a layout audit (tests/e2e/audit.js) after each step: text cut off without an ellipsis, controls overlapping, rows not centred, popups outside the window. SetGITGRAPH_SHOTS=<dir>to keep the screenshots; CI uploads them as artifacts.
See TESTING.md for how gitgraph is tested and what to check on each OS.
flowchart LR
CLI["gitgraph CLI<br/>cli.py"] -->|"spawns, detached"| SRV["local HTTP server<br/>server.py (127.0.0.1, random token)"]
CLI -->|"opens"| WIN["app window / tab<br/>(Chromium --app or default browser)"]
SRV -->|"git log, for-each-ref, show, diff-tree"| GIT[("git repository")]
WIN -->|"GET api/log (streamed)"| SRV
WIN -->|"GET api/meta, api/commit, api/files"| SRV
SRV -->|"SSE api/events: repo changed"| WIN
WIN --- LAY["layout.js<br/>incremental lane layout"]
WIN --- APP["app.js<br/>canvas graph + virtual rows"]
src/gitgraph/gitdata.py: every git call; validates SHAs and ref names before they reach git, and pins output-affecting config (log.showSignature, colors, encoding).src/gitgraph/server.py: stdlibThreadingHTTPServer. Binds to127.0.0.1only, every URL carries a random token, theHostheader must be loopback (blocks DNS rebinding), strict CSP. The app window is started with thefile://URL of a private (0600) page that forwards to a one-time/open/<code>link, which redirects to the token URL; the page is deleted once used. So neither the token nor the code shows up in a process listing. Browser tabs (--tab, or no Chromium-family browser) and snap-packaged browsers on Linux get the one-time link directly, where it is briefly visible to other local users: one who redeems it before your browser does gets read access to the repository's history, messages and file names for as long as the server runs (your window then shows "link already used", so this cannot go unnoticed). On a shared machine, prefer the default app-window mode with a non-snap browser. A hostile local user can also tie up the server with idle connections (denial of service only); gitgraph does not defend against that. Each open page holds oneapi/eventsconnection and sends anapi/byebeacon when it closes. A watcher polls the refs (and the shallow-clone state) every 1.5 s while a page is open and pushesrefsevents.src/gitgraph/web/layout.js: assigns each commit a row and a column and each parent link an edge(child row/col, lane, parent row/col). Lanes never move sideways, so streaming more commits never reshuffles what is on screen. A snapshot of running edges every 64 rows makes "which edges cross rows a..b" a cheap query.src/gitgraph/web/app.js: draws the graph and date column on a canvas and recycles a small pool of DOM rows, so the cost of a frame does not depend on the size of the history.
All routes live under /<token>/.
| Route | Returns |
|---|---|
api/meta |
repository name and path, HEAD, refs, defaults from the command line |
api/log?order=&scope=&ref=&remotes=&tags=&max= |
streamed git log: one commit per line, fields separated by \x1f (sha, parents, commit time, author time, author, e-mail, subject), ended by \x1eEND\t<exit code> |
api/commit?sha= |
full message, author, committer and dates of one commit |
api/files?sha= |
files changed against the first parent (--numstat, renames detected) |
api/events |
server-sent events: hello, then refs whenever the refs change |
POST api/bye |
the page is closing (lets the server exit right away) |
Bug reports and pull requests are welcome: see CONTRIBUTING.md. Please report security problems privately (SECURITY.md).
MIT © Edoardo Panichi


