cherry-merge script fix

This commit is contained in:
2026-01-10 17:25:56 +01:00
parent c5c6d93689
commit 5d20fc669f
2 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
MAIN_BRANCH="main"
TARGET_BRANCH=$(git branch --show-current)
if [ -z $TARGET_BRANCH ]; then
echo "Cannot find target branch, are you in a git repo?"
exit 1
fi
if [ $MAIN_BRANCH == $TARGET_BRANCH ]; then
echo "You cant merge main into main, silly"
exit 1
fi
echo "Target branch: $TARGET_BRANCH"
sleep 2
git switch "$MAIN_BRANCH" || exit 1
git cherry-pick "$TARGET_BRANCH" || exit 1
git switch "$TARGET_BRANCH" || exit 1
git merge "$MAIN_BRANCH" || exit 1