summaryrefslogtreecommitdiff
path: root/clean.sh
diff options
context:
space:
mode:
Diffstat (limited to 'clean.sh')
-rwxr-xr-xclean.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/clean.sh b/clean.sh
new file mode 100755
index 0000000..c317bc6
--- /dev/null
+++ b/clean.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -ex
+
+PAGER=cat
+EMAIL="go.wigust@gmail.com"
+
+repository="$1"
+for branch in $(git -C $repository branch --remotes | grep -v 'HEAD\|master'); do
+ [[ $(git -C $repository log --format='%ae' $branch | head -1) == "$EMAIL" ]] \
+ && git -C $repository push --delete origin ${branch#origin/} \
+ || echo "$branch doesn't belong to $EMAIL or doesn't exists on remote."
+done