Clear old local branches This helps to git your local git clean by deleting all branches, but develop, main and master: git branch -l | egrep -v "(^\*|master|main|develop)" | xargs git branch -D