DEV Community

Discussion on: 🍂 Remove gone git branches

Collapse
 
graysonlang profile image
Grayson Lang • Edited

Thanks, this is great! Minor tweak to use the --filter option to make sure we're not possibly matching on commit string contents (as unlikely as that may be):

[alias]
    gone = "!f() { git fetch --all --prune; git branch --format '%(refname:short) %(upstream:track)' | awk '/\\[gone\\]/{print $1}' | xargs git branch -D; }; f"
Enter fullscreen mode Exit fullscreen mode