37 lines
716 B
Bash
Executable File
37 lines
716 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
DEV_BRANCH="dev"
|
|
MAIN_BRANCH="main"
|
|
|
|
if ! git rev-parse --verify "$DEV_BRANCH" > /dev/null 2>&1; then
|
|
echo "Branch $DEV_BRANCH does not exist locally!"
|
|
exit 1
|
|
fi
|
|
|
|
git switch "$DEV_BRANCH"
|
|
|
|
message="$(date --iso-8601=seconds)"
|
|
echo "$message"
|
|
|
|
git add -A
|
|
if ! git diff --cached --quiet; then
|
|
git commit -m "$message"
|
|
else
|
|
echo "No changes to commit on $DEV_BRANCH."
|
|
fi
|
|
|
|
git fetch origin "$MAIN_BRANCH"
|
|
git merge --no-edit "origin/$MAIN_BRANCH"
|
|
|
|
git push origin "$DEV_BRANCH"
|
|
|
|
git switch "$MAIN_BRANCH"
|
|
git fetch origin "$MAIN_BRANCH"
|
|
git merge --no-edit "origin/$MAIN_BRANCH"
|
|
git merge --no-edit "$DEV_BRANCH"
|
|
git push origin "$MAIN_BRANCH"
|
|
|
|
git switch "$DEV_BRANCH"
|