Remove all local branches except master and release. https://www.computerhope.com/unix/ugrep.htm git branch | grep -v "master\|release" | xargs git branch -D