Over time, local branches pile up, especially after merging or deleting them remotely. To remove local branches that no longer have a remote counterpart, follow these simple steps:
1οΈβ£ List branches that are gone from the remote:
π git branch -vv | awk '/: gone]/{print $1}'
3οΈβ£ Delete them:
π git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
β οΈ If Git complains that a branch is not fully merged, use -D instead of -d, but be careful! π¨
Keep your workspace clean & organized! β