git remove 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 delete branches that aren't on remote

git fetch --all --prune

Example 3: git delete remote branch

#delete remote branch
git push -d <remote_name> <branch_name>
#example: git push -d origin new_feature

#delete local branch
git branch -d <branch_name>
#example: git branch -d new_feature

Example 4: git delete remote branch

$ git push -d <remote_name> <branch_name>
$ git branch -d <branch_name>

Example 5: git delete remote branch

$ git push origin --delete feature/login