Last active
August 29, 2015 14:15
-
-
Save stekycz/4ca5a833bf44f9f84530 to your computer and use it in GitHub Desktop.
All git projects in folder garbage collection
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
if tput setaf 1 &> /dev/null; then | |
tput sgr0 | |
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then | |
# Changed these colors to fit Solarized theme | |
MAGENTA=$(tput setaf 125) | |
ORANGE=$(tput setaf 166) | |
GREEN=$(tput setaf 64) | |
PURPLE=$(tput setaf 61) | |
WHITE=$(tput setaf 244) | |
else | |
MAGENTA=$(tput setaf 5) | |
ORANGE=$(tput setaf 4) | |
GREEN=$(tput setaf 2) | |
PURPLE=$(tput setaf 1) | |
WHITE=$(tput setaf 7) | |
fi | |
BOLD=$(tput bold) | |
RESET=$(tput sgr0) | |
else | |
MAGENTA="\033[1;31m" | |
ORANGE="\033[1;33m" | |
GREEN="\033[1;32m" | |
PURPLE="\033[1;35m" | |
WHITE="\033[1;37m" | |
BOLD="" | |
RESET="\033[m" | |
fi | |
export MAGENTA | |
export ORANGE | |
export GREEN | |
export PURPLE | |
export WHITE | |
export BOLD | |
export RESET |
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
#!/bin/bash | |
if [ -z "$1" ] ; then | |
in="~" | |
else | |
in=$1 | |
fi | |
cur_dir=$(pwd) | |
for dir in $(find $in -name .git -type d -not -regex .*vendor.*) | |
do | |
echo -e "$MAGENTA$dir$RESET" | |
cd $dir && cd .. && git gc | |
echo "" | |
done | |
cd $cur_dir | |
echo -e "$GREEN"Done"$RESET" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment