My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mfprune 925B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. #
  3. # mfprune
  4. #
  5. # Prune all your merged branches and any branches whose remotes are gone
  6. # Great way to clean up your branches after messing around a lot
  7. #
  8. echo "Fetching latest upstream and origin..."
  9. git fetch upstream
  10. git fetch origin
  11. echo
  12. echo "Pruning Merged Branches..."
  13. git branch --merged | egrep -v "^\*|RC|RCBugFix|dev" | xargs -n 1 git branch -d
  14. echo
  15. echo "Pruning Remotely-deleted Branches..."
  16. git branch -vv | egrep -v "^\*|RC|RCBugFix|dev" | grep ': gone]' | gawk '{print $1}' | xargs -n 1 git branch -D
  17. echo
  18. echo "You may want to remove (or checkout) these refs..."
  19. comm -23 \
  20. <(git branch --all | sed 's/^[\* ] //' | grep origin/ | grep -v "\->" | awk '{ print $1; }' | sed 's/remotes\/origin\///') \
  21. <(git branch --all | sed 's/^[\* ] //' | grep -v remotes/ | awk '{ print $1; }') \
  22. | awk '{ print "git branch -d -r origin/" $1; print "git checkout origin/" $1 " -b " $1; }'
  23. echo