Guest User

Untitled

a guest
Jul 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. while read branch; do
  4. upstream=$(git rev-parse --abbrev-ref $branch@{upstream} 2>/dev/null)
  5. if [[ $? == 0 ]]; then
  6. echo $branch tracks $upstream
  7. else
  8. echo $branch has no upstream configured
  9. git branch -D $branch
  10. if [ -z $? ]; then
  11. echo $branch was successfull deleted
  12. else
  13. echo "$branch was not fully merged. Force it change to -D in script"
  14. fi
  15. fi
  16. done < <(git for-each-ref --format='%(refname:short)' refs/heads/*)
Add Comment
Please, Sign In to add comment