From 8d795ad7074b6e10f0031feb9fabd6dceb7c5779 Mon Sep 17 00:00:00 2001 From: pika Date: Thu, 3 Jul 2025 15:56:35 +0200 Subject: [PATCH] wip --- .zsh/.aliases.zsh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.zsh/.aliases.zsh b/.zsh/.aliases.zsh index b40f8ec..d720594 100644 --- a/.zsh/.aliases.zsh +++ b/.zsh/.aliases.zsh @@ -530,21 +530,24 @@ __git__() { ;; esac - [[ -z "$commit_files" ]] && commit_files=. - [[ -z "$commit_message" ]] && commit_message=wip + if [ -n "$commit_files" ] || [ -n "$commit_message" ]; then + echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}" - echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}" + [[ -z "$commit_files" ]] && commit_files=. + [[ -z "$commit_message" ]] && commit_message=wip + + if (("${#commit_files}" <= 1)); then + git add $commit_files + else + for f in "${commit_files[@]}"; do + git add $f + done + fi + + git commit -m "${commit_message:-wip}" + git push - if (("${#commit_files}" <= 1)); then - git add $commit_files - else - for f in "${commit_files[@]}"; do - git add $f - done fi - - git commit -m "${commit_message:-wip}" - git push else echo "${RED}${BOLD}There are changes on the remote branch. Please pull the latest changes first.${NC}" fi