dotfiles/local/bin/git-sweep
2023-02-28 16:43:49 -05:00

7 lines
212 B
Bash
Executable File

#!/usr/bin/env bash
git branch --merged "$([[ "${1}" != "-f" ]] && git rev-parse HEAD)" |
grep -Ev '(^\*|^\s*(main|master|develop)$)' |
while read -r branch_name; do
git branch -d "${branch_name}"
done