{
  "id": 6747584,
  "title": "My local repos were full of zombie branches and git never told me which ones were safe to delete",
  "url": "https://urgent.news/2026/09/11/my-local-repos-were-full-of-zombie-branches-and-git-never-told-me",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-11T11:03:15.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/raknaos/my-local-repos-were-full-of-zombie-branches-and-git-never-told-me-which-ones-were-safe-to-delete-39fn"
  },
  "original_language": "en",
  "account": "Last week, the author ran the command 'git branch' in one of their older working directories and was overwhelmed by the sheer number of local branches listed - forty-some. This clutter was not a concern for disk space, but rather it made other git commands less efficient. Git log --all became noisy, tab completion for branch names stopped working, and the task of pruning became a daunting prospect, as deleting a branch that was thought to be dead could lead to a headache weeks later when a commit was needed. The author attempted the usual methods, such as using git branch --merged main, but it also listed the current branch and deleting a branch based on the output could lead to disastrous consequences. Another method, git branch -vv, showed [gone] for branches whose upstream had vanished, but it required manual interpretation of the output. No single command provided reasons per branch, which led the author to create a Python script named git-stale. This tool, consisting of a 5,092-byte single file, imports four modules from Python's standard library and runs without any additional installations. The core functionality of the script checks if a branch is merged into the default branch, if its upstream branch no longer exists, or if its last commit is older than a specified threshold. The script uses a thin wrapper-over-git approach, asking git itself to determine the truth, rather than introducing potential bugs by attempting to replicate merge-base logic or parse the index.",
  "summary": "Last week I ran git branch in one of my older working trees and got back forty-some local branches. Forty. I work on maybe three things at a time. The rest were residue: half of them were merged into main months ago, a few tracked remote branches that someone had already deleted on the server, and the rest I genuinely did not recognize anymore. The problem with this pile is not disk space. A…",
  "key_points": [
    "Author discovered 40+ local branches in older working directory",
    "git branch --merged main listed current branch, causing confusion",
    "Python script git-stale automates branch pruning decisions"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}