Tech News
← Back to articles

I found a useful Git one liner buried in leaked CIA developer docs

read original related products more articles

Cleaning up merged git branches: a one-liner from the CIA's leaked dev docs 20 Feb 2026

In 2017, WikiLeaks published Vault7 - a large cache of CIA hacking tools and internal documents. Buried among the exploits and surveillance tools was something far more mundane: a page of internal developer documentation with git tips and tricks.

Most of it is fairly standard stuff, amending commits, stashing changes, using bisect. But one tip has lived in my ~/.zshrc ever since.

The Problem

Over time, a local git repo accumulates stale branches. Every feature branch, hotfix, and experiment you’ve ever merged sits there doing nothing. git branch starts to look like a graveyard.

You can list merged branches with:

git branch --merged

But deleting them one by one is tedious. The CIA’s dev team has a cleaner solution:

The original command

git branch --merged | grep -v "\*\|master" | xargs -n 1 git branch -d

... continue reading