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
#!/bin/bash | |
function gprune() { | |
for branch in $(git branch --no-color --list --format='%(refname:short)'); do | |
# Keep branch if it exists on remote or if it's the current. | |
if git show-branch remotes/origin/$branch >/dev/null 2>&1 || [[ $(git branch --show-current) = $branch ]]; then | |
echo "✅ $branch"; | |
else | |
git branch -D $branch > /dev/null && echo "❌ $branch"; | |
fi |
OlderNewer