Last active
August 23, 2022 02:47
-
-
Save lukeorland/a23327a2c206b07384fbcf24e0eb3a18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env zsh | |
# https://stackoverflow.com/questions/7726949/remove-tracking-branches-no-longer-on-remote/38404202#comment91928557_38404202 | |
function git-prune-not-fully-merged-branches { | |
git fetch | |
git checkout main | |
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -d | |
git checkout - | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment