Skip to content

Instantly share code, notes, and snippets.

@kumbasar
Created November 15, 2018 05:52
Show Gist options
  • Save kumbasar/1b1a1e61171b9e18aeee0ef9281bfa34 to your computer and use it in GitHub Desktop.
Save kumbasar/1b1a1e61171b9e18aeee0ef9281bfa34 to your computer and use it in GitHub Desktop.
How to Prune Local Tracking Git Branches that Do Not Exist on Remote/Origin Anymore
git fetch --prune
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@kumbasar
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment