Last active
May 16, 2018 11:48
-
-
Save gcotelli/5e69c882c66ac1d79c02a7f628617329 to your computer and use it in GitHub Desktop.
Clean Up All Repos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
readonly ANSI_BOLD="\\033[1m" | |
readonly ANSI_RED="\\033[31m" | |
readonly ANSI_GREEN="\\033[32m" | |
readonly ANSI_YELLOW="\\033[33m" | |
readonly ANSI_BLUE="\\033[34m" | |
readonly ANSI_RESET="\\033[0m" | |
readonly ANSI_CLEAR="\\033[0K" | |
print_info() { | |
printf "${ANSI_BOLD}${ANSI_BLUE}%s${ANSI_RESET}\\n" "$1" | |
} | |
print_notice() { | |
printf "${ANSI_BOLD}${ANSI_YELLOW}%s${ANSI_RESET}\\n" "$1" | |
} | |
print_success() { | |
printf "${ANSI_BOLD}${ANSI_GREEN}%s${ANSI_RESET}\\n" "$1" | |
} | |
print_error() { | |
printf "${ANSI_BOLD}${ANSI_RED}%s${ANSI_RESET}\\n" "$1" 1>&2 | |
} | |
for REPO in Boardwalk Buoy HighchartsSt RenoirSt Willow Willow-Bootstrap Willow-JQueryUI Willow-Mixpanel Willow-Playground Willow-SemanticUI Willow-SpinKit | |
do | |
cd $REPO || exit | |
print_notice "Processing $REPO..." | |
print_info "Checkout master ..." | |
git checkout master | |
print_info "Fetch tags ..." | |
git fetch --tags | |
print_info "Pull ..." | |
git pull | |
print_info "Remove local branches ..." | |
git branch | grep -v "master" | xargs -r git branch -d | |
print_info "Prune remote branches ..." | |
git remote update origin --prune | |
print_success "Done!" | |
cd .. | |
print_info "" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment