DEV Community

Shaurya Srivastava
Shaurya Srivastava

Posted on

Git Graveyard: Visualizing Dead Branches, Deleted Files, and Abandoned TODOs with Ollama

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission πŸ‘»πŸŒΌ

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

What I Built

Git Graveyard turns the ghosts of your codebase into a haunted cemetery.

Every long-lived repo is full of things that died quietly: feature branches nobody merged, files deleted in a refactor, and # TODO: fix this properly comments from years ago. They're still in Git history, but nobody sees them. Git Graveyard finds them and buries them as tombstones on a dark, foggy web page.

It finds three kinds of graves:

  • Dead branches: local branches that are unmerged and idle for 90+ days
  • Deleted files: every deletion in history, with the file's lifespan
  • Abandoned TODOs: TODO/FIXME/HACK comments that git blame says are 180+ days old

Each tombstone shows the name, birth and death dates, age, cause of death, author, last commit message, and a short darkly funny epitaph written by a local LLM.

For "Ghost in the Machine", I read the theme literally: the ghosts in your machine are the things your code left behind. A deleted file still has a "last words" commit message. There's even a Resurrection Chamber that shows the exact command to bring each dead file back.

Demo

The generated page has:

  • Fog, moonlight, and a lantern glow on hover
  • Search, filters by type and cause, and sorting by oldest, newest, lifespan, or author
  • A ghost mode with floating ghosts and flickering stones
  • Statistics and insights such as "most haunted file" (deleted and resurrected several times)

Code

πŸͺ¦ Git Graveyard

Where forgotten code rests in peace.

Git Graveyard reads a Git repository's history and turns everything that died in it into a tombstone: abandoned branches, deleted files, and TODO comments nobody ever finished. A small local language model writes a darkly funny epitaph for each one. The result is a single HTML page you can open offline.

The rule that keeps it honest: Git supplies every fact. Plain Python decides the cause of death. The LLM only writes the epitaph. It never decides a date, a name, an author, whether a branch was merged, or why a file was deleted.

Graveyard header and statistics Resurrection chamber

Screenshots are from the demo repository (scripts/make_demo_repo.py). Replace them with your own.


Why it exists

Every long-lived repository is also a cemetery. Half-finished feature branches, modules deleted during a refactor, and # TODO: fix this properly comments from three years ago are all still in…

How I Built It

The core design rule: Git supplies the facts, Python decides the cause of death, and the LLM only writes the jokes.

Git repo β†’ Collector β†’ Classifier β†’ Local LLM β†’ HTML page
           (git CLI)   (Python)     (Ollama)    (Jinja2)
Enter fullscreen mode Exit fullscreen mode
  • Collector: read-only git log, git blame, and git grep through subprocess, with no shell. A strict allow-list blocks any command that could change the repo.
  • Classifier: fixed rules with clear precedence. For example, a revert in the commit message beats remove, because Revert "Remove X" is a revert. Branches are judged on merge state and idleness only.
  • Epitaph writer: Ollama running Llama 3.2 3B locally. The model gets a short list of facts and a strict prompt: one or two sentences, use only the facts. I validate every reply and reject any that contain a number not in the facts, so it can't invent dates or ages. Accepted epitaphs are cached by a hash of the facts, model, and prompt version.
  • Fallback: if Ollama isn't running, the model isn't installed, or requests time out, the tool switches to deterministic template epitaphs and keeps working.
  • Renderer: one self-contained HTML file. The CSS, JS, and an open-license gothic font (Pirata One) are inlined, and a Content-Security-Policy blocks all outside requests.

It's tested with 92 pytest tests that build temporary Git repos with backdated commits. They cover merged vs. unmerged branches, files deleted and recreated, TODO ages, classification precedence, cache invalidation, every Ollama failure mode, HTML escaping, and a check that the analyzed repo is untouched.

You can swap the model with one flag: --model qwen2.5:3b.

Why Does Open Innovation Matter?

Git history is some of the most private data a developer has. Commit messages, file names, and author names reveal a lot about a company's internal work. A closed cloud API would mean sending that history to someone else's server.

With open-weight models and local inference:

  • Privacy: your repo's history never leaves your machine. The model runs on localhost.
  • Offline: the whole thing works with the internet off.
  • Free to run: it costs nothing, even on a repo with thousands of graves.
  • Swappable: the "ghostwriter's" personality is a one-line change. Try Llama, Qwen, or Gemma and compare epitaphs. With a closed API, the provider can change the model under you.
  • Control: I set the temperature, length, and prompt, and I can validate and reject the output.

The open approach also shaped the architecture. Because I own the model, I could treat it as one small, replaceable component. A 3B model is good at short creative text but bad at facts, so it only writes jokes while Git and Python handle everything that must be correct.

The Spirit of It

DΓ­a de los Muertos isn't about being afraid of the dead. It's about remembering them and keeping their stories alive. I wanted Git Graveyard to do that for code.

Every tombstone in the graveyard was once someone's work. A branch that never got merged was an idea somebody believed in for a week. A deleted file was useful until the day it wasn't. A # TODO is a promise someone made to their future self. Normally these just vanish from view, and nobody remembers they existed.

So each grave keeps what's left of its story:

  • Born and died: the real dates, straight from Git
  • Last words: the commit message that ended it, such as "remove legacy module" or "wip"
  • Cause of death: Abandoned and forgotten, Killed by a revert, Died during refactoring
  • Its people: the author who wrote it and the one who buried it

The epitaph is the small ritual on top, a line of dark humor from a model running on your own machine, a bit like a candle at an ofrenda.

I also added the Resurrection Chamber, because remembering something and being able to bring it back are close to the same thing. For every deleted file, it shows the exact git checkout command that restores it. The page never runs it for you. Bringing something back is a choice you make yourself.

Top comments (0)