Add a full script version of git-sweep

with a smidge more resilience
This commit is contained in:
2023-02-28 16:43:49 -05:00
parent 0390fdb43d
commit 5ddd23b1d0
2 changed files with 6 additions and 1 deletions

6
local/bin/git-sweep Executable file
View File

@@ -0,0 +1,6 @@
#!/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