summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-07-18 17:53:25 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-07-18 17:53:25 +0200
commite4d8d98ea1cad99f312288198dd0df5f09e07e7d (patch)
treec6aaf855b441ccb14d7519f45d992c1a5c43ad5c
parentaa3b765c15aec711d032472ffd57f712bee19480 (diff)
downloadbin-e4d8d98ea1cad99f312288198dd0df5f09e07e7d.zip
bin-e4d8d98ea1cad99f312288198dd0df5f09e07e7d.tar.gz
git-synk: don't checkout a non already checked out branch
-rwxr-xr-xgit-synk2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-synk b/git-synk
index fe9521b..993cf5a 100755
--- a/git-synk
+++ b/git-synk
@@ -41,7 +41,7 @@ for gitdir in ${GIT_DIR}; do
echo -e " ${RED}${GIT_REMOTE} remote not found ${RESET}" && cd .. && continue
fi
# CHECKOUT
- echo -ne " ${CYAN}checkout $YELLOW$GIT_BRANCH$RESET ... " && git checkout -q ${GIT_BRANCH} 2>/dev/null && echo -e "${GREEN}OK${RESET}"
+ echo -ne " ${CYAN}checkout $YELLOW$GIT_BRANCH$RESET ... " && git branch | grep -q -e " ${GIT_BRANCH}\$" && git checkout -q ${GIT_BRANCH} 2>/dev/null && echo -e "${GREEN}OK${RESET}"
if [ $? -ne 0 ]; then
echo -e "${RED}KO${RESET}" && cd .. && continue
fi