summaryrefslogtreecommitdiff
path: root/.local/bin/git-prune-pushed-branches
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/git-prune-pushed-branches')
-rwxr-xr-x.local/bin/git-prune-pushed-branches6
1 files changed, 6 insertions, 0 deletions
diff --git a/.local/bin/git-prune-pushed-branches b/.local/bin/git-prune-pushed-branches
new file mode 100755
index 0000000..e711560
--- /dev/null
+++ b/.local/bin/git-prune-pushed-branches
@@ -0,0 +1,6 @@
+#!/bin/bash
+git for-each-ref --format='%(refname)' refs/heads/ |while read -r ref; do
+ if git merge-base --is-ancestor "$ref" "refs/remotes/origin/${ref#refs/heads/}"; then
+ echo "${ref#refs/heads/}"
+ fi
+done | xargs -r git branch -D