Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- while read branch; do
- upstream=$(git rev-parse --abbrev-ref $branch@{upstream} 2>/dev/null)
- if [[ $? == 0 ]]; then
- echo $branch tracks $upstream
- else
- echo $branch has no upstream configured
- git branch -D $branch
- if [ -z $? ]; then
- echo $branch was successfull deleted
- else
- echo "$branch was not fully merged. Force it change to -D in script"
- fi
- fi
- done < <(git for-each-ref --format='%(refname:short)' refs/heads/*)
Add Comment
Please, Sign In to add comment