19 lines
404 B
Bash
Executable File
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
|
|
|