git delete local branch not on remote code example
Example 1: delete local branches not on remote
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -D
Example 2: git branch delete local and remote
// delete branch locally
git branch -d localBranchName
// delete branch remotely
git push origin --delete remoteBranchName
Example 3: git delete branches that aren't on remote
git fetch --all --prune
Example 4: git delete remote branches in local git
git fetch --all --prune
Example 5: git delete local branch
git branch -d test
Example 6: remove local branch
git branch -d branch_namegit branch -D branch_name