Skip to content

Instantly share code, notes, and snippets.

@yurikilian
Created June 30, 2021 11:16
Show Gist options
  • Save yurikilian/fffc348dfe6168b519ea74ac4826a9a0 to your computer and use it in GitHub Desktop.
Save yurikilian/fffc348dfe6168b519ea74ac4826a9a0 to your computer and use it in GitHub Desktop.
prune local branches
#!/bin/bash
gitprune(){
set -x
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