This commit is contained in:
pika 2025-03-24 14:21:47 +01:00
parent 4961cf01b0
commit 78d44ea65a

34
.zshrc
View file

@ -354,23 +354,26 @@ __alias__() {
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"
gsu() { gsu() {
echo_info "Pulling submodules..." echo "| git submodule foreach git pull --recurse-submodule |"
if git submodule foreach git pull --recurse-submodule; then git submodule foreach git pull --recurse-submodule &&
echo_info "Submodules pulled successfully." echo "-- pulled down submodules recursively"
else
echo_error "Failed to pull submodules."
return 1
fi
echo_info "Updating submodules..." echo "| git submodule update --init --recursive |"
if git submodule update --init --recursive; then git submodule update --init --recursive
echo_info "Submodules updated successfully."
else
echo_error "Failed to update submodules."
return 1
fi
if git diff .; then echo "-- Checking submodule branches... --"
git submodule foreach '
branch=$(git symbolic-ref --short HEAD 2>/dev/null || echo "detached")
if [ "$branch" = "detached" ]; then
default_branch=$(git config -f $toplevel/.gitmodules submodule.$name.branch || echo "main")
echo "Submodule $name is detached. Checking out $default_branch..."
git checkout $default_branch
else
echo "Submodule $name is on branch $branch."
fi
'
if git diff --quiet .; then
echo_info "Staging changes..." echo_info "Staging changes..."
git add . git add .
sleep 0.3 sleep 0.3
@ -391,6 +394,7 @@ __alias__() {
return 1 return 1
fi fi
} }
gwip() { gwip() {
# Fetch the latest changes from the remote # Fetch the latest changes from the remote
git fetch git fetch