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.

mfclean 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. #
  3. # mfclean
  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. which awk >/dev/null && AWK=awk
  9. which gawk >/dev/null && AWK=gawk
  10. KEEP="RC|RCBugFix|dev|master|bugfix-1|bugfix-2"
  11. echo "Fetching latest upstream and origin..."
  12. git fetch upstream
  13. git fetch origin
  14. echo
  15. echo "Pruning Merged Branches..."
  16. git branch --merged | egrep -v "^\*|$KEEP" | xargs -n 1 git branch -d
  17. echo
  18. echo "Pruning Remotely-deleted Branches..."
  19. git branch -vv | egrep -v "^\*|$KEEP" | grep ': gone]' | "$AWK" '{print $1}' | xargs -n 1 git branch -D
  20. echo
  21. # List fork branches that don't match local branches
  22. echo "You may want to remove (or checkout) these refs..."
  23. comm -23 \
  24. <(git branch --all | sed 's/^[\* ] //' | grep origin/ | grep -v "\->" | awk '{ print $1; }' | sed 's/remotes\/origin\///') \
  25. <(git branch --all | sed 's/^[\* ] //' | grep -v remotes/ | awk '{ print $1; }') \
  26. | awk '{ print "git branch -d -r origin/" $1; print "git checkout origin/" $1 " -b " $1; print ""; }'
  27. echo