From 13946335214b0c3658e861c553e63b8c455500bc Mon Sep 17 00:00:00 2001 From: pika Date: Sun, 11 May 2025 16:34:16 +0200 Subject: [PATCH] fixed wip --- .zshrc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.zshrc b/.zshrc index d38d019..5d09695 100644 --- a/.zshrc +++ b/.zshrc @@ -323,12 +323,23 @@ __git__() { alias gm='git checkout main && git merge' alias gc="git clone --recurse-submodule" alias gd="git diff" - alias ga="gd $1 && git add" + # alias ga="gd $1 && git add" alias gp='echo "${CYAN}Updating submodules..${NC}" && git submodule update --init --recursive && echo "${CYAN}Pulling down submodules..${NC}" && git pull --recurse-submodule' alias gms='git maintenance start' alias gcm="git commit -m" alias gpu="git push --recurse-submodule=on-demand" + ga() { + if [ -n "$2" ]; then + git diff ${1:-.} + git add ${1:-.} + git commit -m "$2" + else + gd ${1:-.} + git add ${1:-.} + fi + } + # ──────────────────────────────────────< functions >──────────────────────────────────── gcl() { if [ -z "$2" ]; then @@ -409,8 +420,13 @@ __git__() { # Check if there are any changes on the remote branch if git diff --quiet "$branch" "origin/$branch"; then - local commit_message="${1:-wip}" - local commit_files="${2:-.}" + if [ -n "$2" ]; then + local commit_files="${1:-.}" + local commit_message="${2:-wip}" + else + local commit_message="${1:-wip}" + fi + echo "${CYAN}No changes on the remote branch. Adding changes and pushing with ${RED}${BOLD}'$commit_message'${NC}${CYAN} commit.${NC}" git add "$commit_files" git commit -m "$commit_message"