Skip to content

Instantly share code, notes, and snippets.

@carlowens
Created June 4, 2013 16:10
Show Gist options
  • Save carlowens/5707214 to your computer and use it in GitHub Desktop.
Save carlowens/5707214 to your computer and use it in GitHub Desktop.
Delete unwanted git branches from remote
#!/bin/bash
echo "Deleting remote branches contained within to-be-deleted-branches.txt"
while read BRANCH_NAME
do
echo -e "$BRANCH_NAME \n"
if [ ! -L "${BRANCH_NAME}" ]; then
git push origin --delete $BRANCH_NAME
fi
done < to-be-deleted-branches.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment