Skip to content

Instantly share code, notes, and snippets.

@robvolk
Created August 21, 2018 16:58
Show Gist options
  • Save robvolk/cc40fc988e6ecd9250086ff2c8e906ef to your computer and use it in GitHub Desktop.
Save robvolk/cc40fc988e6ecd9250086ff2c8e906ef to your computer and use it in GitHub Desktop.
Cleanup git branches
gitc() {
git fetch --prune
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`;
do
git branch -D $branch
done;
git branch --merged master | grep -v '^*' | grep -v '^ master$' | xargs git branch -d
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment