Files
first/pull.sh
2025-08-26 18:33:56 +02:00

19 lines
404 B
Bash
Executable File

#!/usr/bin/env bash
# Define the branch name
BRANCH_NAME="dev"
if [ ! $(git rev-parse --abbrev-ref HEAD) == $BRANCH_NAME ]; then
# Fetch the latest changes from the remote
git fetch origin
# If the branch exists, just switch to it
git switch $BRANCH_NAME || (git switch -c $BRANCH_NAME && git push -u origin $BRANCH_NAME)
fi
# get the latest changes
git pull origin $BRANCH_NAME --ff-only