Shell/Bash: delete local branches not on remote Example

By

Shell/Bash Example: This is the "delete local branches not on remote" Example. compiled from many sources on the internet by SimpleTutorials.org

delete local branches not on remote

git branch -vv | grep ': gone]'|  grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -D

git delete branches that aren't on remote

git fetch --all --prune

git delete remote branches in local git

# Fetch changes from all remotes and locally delete 
# remote deleted branches/tags etc
# --prune will do the job :-;
git fetch --all --prune

git delete local branches not on remote

git fetch -p && for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D $branch; done



* Summary: This "delete local branches not on remote" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!

Others