cherry-merge script

This commit is contained in:
2026-01-10 17:20:55 +01:00
parent e56bd25b94
commit 636c6a1917
2 changed files with 31 additions and 0 deletions

View File

@@ -9,3 +9,9 @@ alias girlboss="sudo"
alias vialias="nvim $HOME/.oh-my-zsh/custom/aliases.zsh" alias vialias="nvim $HOME/.oh-my-zsh/custom/aliases.zsh"
alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg" alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
#############
## Scripts ##
#############
alias cherry-merge="$ZSH_CUSTOM/scripts/cherry-merge.zsh"

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env zsh
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