Created
October 1, 2020 17:57
-
-
Save walkerdepaula/b4c092b2e1056363cb37ba171a4db443 to your computer and use it in GitHub Desktop.
Revisions
-
walkerdepaula created this gist
Oct 1, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ **(requires bash or zsh, won't work with standard Bourne shell)** After pruning, you can get the list of remote branches with `git branch -r`. The list of branches with their remote tracking branch can be retrieved with `git branch -vv`. So using these two lists you can find the remote tracking branches that are not in the list of remotes. 1: ``` $ git fetch --prune ``` 2: ``` $ git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d ```