Skip to content

Instantly share code, notes, and snippets.

@DeVoresyah
Created September 21, 2022 07:19
Show Gist options
  • Save DeVoresyah/9a5bf6a18b38c1c082f8ed33788b465e to your computer and use it in GitHub Desktop.
Save DeVoresyah/9a5bf6a18b38c1c082f8ed33788b465e to your computer and use it in GitHub Desktop.
Bash file to clear unused branch
#!/bin/bash
function cb() {
git fetch -p ; git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment