Skip to content

Instantly share code, notes, and snippets.

@datYori
Last active December 23, 2021 06:24
Show Gist options
  • Save datYori/6e40fc113c9022b476194add28ac0580 to your computer and use it in GitHub Desktop.
Save datYori/6e40fc113c9022b476194add28ac0580 to your computer and use it in GitHub Desktop.
clean branch
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment