Web3CV/update-from-gitea.sh

29 lines
695 B
Bash
Executable File

#!/bin/bash
# This script updates the local repository from Gitea
echo "Updating local repository from Gitea..."
# Fetch the latest changes from Gitea
git fetch origin
# Check if there are any changes
if git diff --quiet HEAD origin/main; then
echo "Local repository is already up to date."
else
echo "New changes detected. Updating local repository..."
# Stash any local changes
git stash
# Pull the latest changes
git pull origin main
# Apply stashed changes if any
if git stash list | grep -q "stash@{0}"; then
echo "Applying stashed changes..."
git stash pop
fi
echo "Local repository updated successfully!"
fi