This commit is contained in:
parent
388cb2017d
commit
43128906a1
21
teste.sh
21
teste.sh
@ -10,8 +10,21 @@ echo -e "
|
|||||||
|
|
||||||
echo "Today is " `date`
|
echo "Today is " `date`
|
||||||
|
|
||||||
echo -e "\nenter the path to directory"
|
# Atualizar informação do remoto (fetch)
|
||||||
read the_path
|
git fetch origin
|
||||||
|
|
||||||
echo -e "\n you path has the following files and folders: "
|
# Verificar se existem atualizações para a branch atual
|
||||||
ls $the_path
|
LOCAL=$(git rev-parse @)
|
||||||
|
REMOTE=$(git rev-parse @{u})
|
||||||
|
BASE=$(git merge-base @ @{u})
|
||||||
|
|
||||||
|
if [ "$LOCAL" = "$REMOTE" ]; then
|
||||||
|
echo "Repositório já está atualizado."
|
||||||
|
elif [ "$LOCAL" = "$BASE" ]; then
|
||||||
|
echo "Existem atualizações. A fazer git pull..."
|
||||||
|
git pull
|
||||||
|
elif [ "$REMOTE" = "$BASE" ]; then
|
||||||
|
echo "Repositório local tem commits que o remoto não tem."
|
||||||
|
else
|
||||||
|
echo "Repositório local e remoto divergiram."
|
||||||
|
fi
|
||||||
Loading…
x
Reference in New Issue
Block a user