git clean branch list code example
Example 1: git clean local remote branch
git fetch origin --prune
Example 2: clean local branches git
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d
git fetch origin --prune
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d