Skip to content

Instantly share code, notes, and snippets.

@sandrocarval
Last active May 17, 2017 20:31
Show Gist options
  • Save sandrocarval/cef70b94a806aa2e8ff3969cf991eb4c to your computer and use it in GitHub Desktop.
Save sandrocarval/cef70b94a806aa2e8ff3969cf991eb4c to your computer and use it in GitHub Desktop.
Atualiza todos os repos do cloudficacao
#!/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