CountryBlock/atualizar.sh
2025-06-23 15:34:49 +01:00

33 lines
1.6 KiB
Bash

#!/bin/bash
echo -e "
░█████╗░██╗██╗░░██╗██████╗░░░░██████╗░██╗░░░██╗███╗░░██╗
██╔══██╗██║╚██╗██╔╝██╔══██╗░░░██╔══██╗██║░░░██║████╗░██║
██║░░██║██║░╚███╔╝░██████╦╝░░░██████╔╝██║░░░██║██╔██╗██║
██║░░██║██║░██╔██╗░██╔══██╗░░░██╔══██╗██║░░░██║██║╚████║
╚█████╔╝██║██╔╝╚██╗██████╦╝██╗██║░░██║╚██████╔╝██║░╚███║
░╚════╝░╚═╝╚═╝░░╚═╝╚═════╝░╚═╝╚═╝░░╚═╝░╚═════╝░╚═╝░░╚══╝"
echo "Today is " `date`
# Atualizar informação do remoto (fetch)
git fetch origin
# 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
bash start.sh