Last active
May 17, 2017 20:31
-
-
Save sandrocarval/cef70b94a806aa2e8ff3969cf991eb4c to your computer and use it in GitHub Desktop.
Atualiza todos os repos do cloudficacao
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 | |
# Salve este arquivo no $HOME/bin e adicione o caminho no $PATH | |
REPO_BASE="$HOME/repos/totvs" | |
for REPO in $(ls $REPO_BASE/) | |
do | |
echo "-----------------------------------------" | |
echo "$REPO: updating" | |
echo "-----------------------------------------" | |
cd $REPO_BASE/$REPO | |
CURRENT=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match) | |
TAG_CHECKOUT=$(git branch | head -1 | grep "HEAD detached") | |
echo "current: $CURRENT" | |
git fetch && git fetch --tags | |
# if the variable is not empty, the checkout is pointing to a tag | |
if [ "$TAG_CHECKOUT" == "" ] ; then | |
git pull --rebase origin $CURRENT | |
fi | |
echo " " | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment