8 March 2017

Usually you can remove branches that have been deleted on remote with prune (git fetch -p). Although sometimes there are stale branches and it needs a different approach. Reference to original source: How to prune local tracking branches that do not exist on remote anymore.

Source code viewer
  1. git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
Programming Language: Bash