Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Go through all the branches except the current active, asking whether it should
# be preserved or removed. Delete all marked for removal in the second iteration.
branches=()
while IFS= read -rs line ; do
branches+=("${line:2}")
done < <(git branch)