Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions git-prune-local
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
#!/bin/bash

git branch --merged | while read line
do
# If the line is in the format '* master' (indicating the current branch),
# this will be effectively empty, so we don't somehow delete the current
# branch
BRANCH=`echo "$line" | awk -F '*' '{ print $1 }'`

if [ -z "$BRANCH" ]
then
continue
fi

if [ "$BRANCH" == "master" ]
then
continue
fi

git branch -d "$BRANCH"
done
git branch --merged | grep -v ^* | grep -v ^\ \ master$ | xargs git branch -d