diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-30 10:43:35 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-30 10:43:35 +0200 |
commit | f91c47d6e9481d486e1768e4deec515535a8dfe8 (patch) | |
tree | 2f698ba3c6da700350c57d03b6fc8e4d026edca5 /git-synk | |
parent | 82a793b2b3ef68dbadb894b6428d25ab30b8be17 (diff) | |
download | bin-f91c47d6e9481d486e1768e4deec515535a8dfe8.zip bin-f91c47d6e9481d486e1768e4deec515535a8dfe8.tar.gz |
add git-synk
Diffstat (limited to 'git-synk')
-rwxr-xr-x | git-synk | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/git-synk b/git-synk new file mode 100755 index 0000000..c11cbd8 --- /dev/null +++ b/git-synk @@ -0,0 +1,21 @@ +#! /bin/sh + +GIT_BASE=${GIT_BASE:-$HOME/usr/git} +GIT_ORIGIN=${GIT_ORIGIN:-asynk} + +function git_cmd () { + path=$1 + cmd=$2 + cd $path && echo -e "\033[0;33m$cmd\033[0m within \033[0;31m$path\033[0m" || return 1 + for dir in $(ls -1); do + [ -d $dir ] && [ -e $dir/.git/config ] || continue + cd $dir + git remote show $GIT_ORIGIN >/dev/null 2>&1 && echo -e " \033[0;36m$cmd:\033[0;35m $dir\033[0m" && git $cmd $GIT_ORIGIN master + cd .. + done +} + +for gitdir in $GIT_BASE; do + git_cmd "$gitdir" pull + git_cmd "$gitdir" push +done |