Last active
December 6, 2018 16:11
-
-
Save shurph/317ff3aa9fc18df428c6cead8269cb15 to your computer and use it in GitHub Desktop.
Revisions
-
shurph revised this gist
Dec 6, 2018 . 1 changed file with 28 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,13 +5,39 @@ COLOR_BLUE="\e[34m" COLOR_YELLOW="\e[33m" COLOR_DEFAULT="\e[0m" if [ 'pull' = "$1" ]; then GIT_COMMAND='pull' else GIT_COMMAND='fetch' fi; echo GIT_COMMAND is "$GIT_COMMAND" run_before_git_command_DANGEROUS() { git reset --hard HEAD git checkout HEAD~1 git branch -D master git branch master origin/master } run_before_git_command() { # run_before_git_command_DANGEROUS # git checkout master } fetch_git_or_go_deeper() { cd $ROOT_DIR if [ -d "$2/$1/.git" ]; then printf "$COLOR_BLUE FETCHING REPO $1 IN $2 $COLOR_DEFAULT\n" cd $2/$1 run_before_git_command git $GIT_COMMAND --all -t else DIRECTORIES_WITH_SPACES=$(find $2/$1 -maxdepth 1 -type d -name \*' '\*) if test "$DIRECTORIES_WITH_SPACES"; then @@ -31,4 +57,4 @@ fetch_git_or_go_deeper() cd $ROOT_DIR } fetch_git_or_go_deeper . . -
shurph created this gist
Aug 24, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/usr/bin/env sh ROOT_DIR=`pwd`; COLOR_BLUE="\e[34m" COLOR_YELLOW="\e[33m" COLOR_DEFAULT="\e[0m" fetch_git_or_go_deeper() { cd $ROOT_DIR if [ -d "$2/$1/.git" ]; then printf "$COLOR_BLUE FETCHING REPO $1 IN $2 $COLOR_DEFAULT\n" cd $2/$1 git fetch --all -t else DIRECTORIES_WITH_SPACES=$(find $2/$1 -maxdepth 1 -type d -name \*' '\*) if test "$DIRECTORIES_WITH_SPACES"; then printf "$COLOR_YELLOW DIRECTORIES WITH SPACES MAY CAUSE SOME ISSUES\n" echo $DIRECTORIES_WITH_SPACES printf "$COLOR_DEFAULT\n" fi # echo find $2/$1 -maxdepth 1 -type d -name '[a-z]*' \ # -exec fetch_git_or_go_deeper {} $2/$1 \; for i in $(ls $2/$1 -1 --quoting-style=shell-escape --color=none); do if [ -d "$2/$1/$i" ]; then fetch_git_or_go_deeper "$i" "$2/$1" fi done fi cd $ROOT_DIR } fetch_git_or_go_deeper . .