Skip to content

Instantly share code, notes, and snippets.

@codejockie
Created October 22, 2019 06:06
Show Gist options
  • Select an option

  • Save codejockie/34dc8468daa864f8644f310dd0bca8d5 to your computer and use it in GitHub Desktop.

Select an option

Save codejockie/34dc8468daa864f8644f310dd0bca8d5 to your computer and use it in GitHub Desktop.
A tiny utility function to delete old (unused) git branches
function deleteOldBranches() {
for branchName in $(git branch)
do
# We do not want to delete the master branch
if [ $branchName != 'master' ] && [ $branchName != '*' ]
then
echo 🛠 Deleting $branchName
git branch -D $branchName
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment