Skip to content

Instantly share code, notes, and snippets.

@scarfunk
Created August 22, 2024 03:46
Show Gist options
  • Save scarfunk/5e1c48fcc5dce9faa084b25433079830 to your computer and use it in GitHub Desktop.
Save scarfunk/5e1c48fcc5dce9faa084b25433079830 to your computer and use it in GitHub Desktop.
merge-down.sh
# master > stage > dev 체크아웃+머지+푸쉬하기
#!/bin/sh
set -e
# Function to check the status of the last command and exit if it failed
check_status() {
if [ $? -ne 0 ]; then
echo "Error: $1"
exit 1
fi
}
# Checkout stage branch
git checkout stage
check_status "Failed to checkout stage"
# Merge master into stage
git merge master
check_status "Failed to merge master into stage"
# Push stage branch
git push origin stage
check_status "Failed to push stage"
# Checkout dev branch
git checkout dev
check_status "Failed to checkout dev"
# Merge stage into dev
git merge stage
check_status "Failed to merge stage into dev"
# Push dev branch
git push origin dev
check_status "Failed to push dev"
echo "Successfully merged and pushed branches"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment