2025-08-23T19:59:23+02:00
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Define the branch name
|
||||||
|
BRANCH_NAME=dev
|
||||||
|
|
||||||
|
# Check if the branch exists locally
|
||||||
|
if git rev-parse --verify $BRANCH_NAME > /dev/null 2>&1; then
|
||||||
|
|
||||||
|
# Get commit message
|
||||||
|
# message=$(git diff | ~/scripts/shelly 'write a short git commit message for this diff')
|
||||||
|
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
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user