2026-04-13T21:56:56+02:00
This commit is contained in:
@@ -1,36 +1,36 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Define the branch name
|
set -euo pipefail
|
||||||
BRANCH_NAME=dev
|
|
||||||
|
|
||||||
# Check if the branch exists locally
|
DEV_BRANCH="dev"
|
||||||
if git rev-parse --verify $BRANCH_NAME > /dev/null 2>&1; then
|
MAIN_BRANCH="main"
|
||||||
|
|
||||||
# Get commit message
|
if ! git rev-parse --verify "$DEV_BRANCH" > /dev/null 2>&1; then
|
||||||
# message=$(git diff | ~/scripts/shelly 'write a short git commit message for this diff')
|
echo "Branch $DEV_BRANCH does not exist locally!"
|
||||||
message="$(date --iso-8601=seconds)"
|
|
||||||
echo $message
|
|
||||||
|
|
||||||
# Add and commit changes
|
|
||||||
git add .
|
|
||||||
git commit -m "$message"
|
|
||||||
|
|
||||||
# Pull the latest changes from the main branch to ensure we're up to date
|
|
||||||
git pull origin main
|
|
||||||
|
|
||||||
# Push the changes to the remote branch named dev_$(hostname)
|
|
||||||
git push origin $BRANCH_NAME
|
|
||||||
|
|
||||||
# Merge to main
|
|
||||||
git switch main
|
|
||||||
git merge dev
|
|
||||||
git commit
|
|
||||||
git push
|
|
||||||
|
|
||||||
# Switch to the branch
|
|
||||||
git switch $BRANCH_NAME
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "Branch $BRANCH_NAME does not exist locally!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user