Skip to content

Instantly share code, notes, and snippets.

@furlongm
Created March 13, 2019 14:37
Show Gist options
  • Save furlongm/c5a1709da01ec79e6b5b7f8fabb4780c to your computer and use it in GitHub Desktop.
Save furlongm/c5a1709da01ec79e6b5b7f8fabb4780c to your computer and use it in GitHub Desktop.
#!/bin/bash
git checkout master
git remote prune origin
for b in $(git branch -v | grep "\[gone\]" | cut -d " " -f 3) ; do git branch -v -D ${b} ; done
git branch -d $(git branch --merged | grep -vw $(git rev-parse --abbrev-ref HEAD)) 2>/dev/null
git gc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment