diff --git a/zsh/.omz-custom/aliases.zsh b/zsh/.omz-custom/aliases.zsh index 99156b8..9a2a942 100644 --- a/zsh/.omz-custom/aliases.zsh +++ b/zsh/.omz-custom/aliases.zsh @@ -15,3 +15,4 @@ alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg" ############# alias cherry-merge="$ZSH_CUSTOM/scripts/cherry-merge.sh" +alias push-main-current="$ZSH_CUSTOM/scripts/push-main-current.sh" diff --git a/zsh/.omz-custom/scripts/cherry-merge.sh b/zsh/.omz-custom/scripts/cherry-merge.sh index 9f385e1..3a71e06 100755 --- a/zsh/.omz-custom/scripts/cherry-merge.sh +++ b/zsh/.omz-custom/scripts/cherry-merge.sh @@ -14,7 +14,7 @@ if [ $MAIN_BRANCH == $TARGET_BRANCH ]; then fi echo "Target branch: $TARGET_BRANCH" -sleep 2 +sleep 1 git switch "$MAIN_BRANCH" || exit 1 diff --git a/zsh/.omz-custom/scripts/push-main-current.sh b/zsh/.omz-custom/scripts/push-main-current.sh new file mode 100755 index 0000000..c6759fa --- /dev/null +++ b/zsh/.omz-custom/scripts/push-main-current.sh @@ -0,0 +1,19 @@ +#!/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 are on main, silly" + exit 1 +fi + +echo "Target branch: $TARGET_BRANCH" +sleep 1 + +git push origin "$MAIN_BRANCH" "$TARGET_BRANCH"