fixed wip

This commit is contained in:
pika 2025-05-11 16:34:16 +02:00
parent 336fcaf702
commit 1394633521

22
.zshrc
View file

@ -323,12 +323,23 @@ __git__() {
alias gm='git checkout main && git merge' alias gm='git checkout main && git merge'
alias gc="git clone --recurse-submodule" alias gc="git clone --recurse-submodule"
alias gd="git diff" 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 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 gms='git maintenance start'
alias gcm="git commit -m" alias gcm="git commit -m"
alias gpu="git push --recurse-submodule=on-demand" 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 >──────────────────────────────────── # ──────────────────────────────────────< functions >────────────────────────────────────
gcl() { gcl() {
if [ -z "$2" ]; then if [ -z "$2" ]; then
@ -409,8 +420,13 @@ __git__() {
# Check if there are any changes on the remote branch # Check if there are any changes on the remote branch
if git diff --quiet "$branch" "origin/$branch"; then if git diff --quiet "$branch" "origin/$branch"; then
local commit_message="${1:-wip}" if [ -n "$2" ]; then
local commit_files="${2:-.}" 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}" 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 add "$commit_files"
git commit -m "$commit_message" git commit -m "$commit_message"