This commit is contained in:
Bxio 2025-06-23 15:09:24 +01:00
parent 388cb2017d
commit 43128906a1

View File

@ -10,8 +10,21 @@ echo -e "
echo "Today is " `date`
echo -e "\nenter the path to directory"
read the_path
# Atualizar informação do remoto (fetch)
git fetch origin
echo -e "\n you path has the following files and folders: "
ls $the_path
# Verificar se existem atualizações para a branch atual
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