Skip to content

Instantly share code, notes, and snippets.

@lawson-ng
Created November 7, 2022 03:14
Show Gist options
  • Save lawson-ng/227f2b5dfdafed20298c7b87a52fc17e to your computer and use it in GitHub Desktop.
Save lawson-ng/227f2b5dfdafed20298c7b87a52fc17e to your computer and use it in GitHub Desktop.
Delete branches which do not existing in remote
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