Skip to content

Instantly share code, notes, and snippets.

View tazorax's full-sized avatar

Mathieu Cabaret tazorax

View GitHub Profile
@tazorax
tazorax / gitclean.sh
Created November 2, 2023 15:16
Clean local branches which does not exists anymore on remote
#!/bin/bash
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