diff --git a/.zshrc b/.zshrc index 60f179e..43e6805 100644 --- a/.zshrc +++ b/.zshrc @@ -354,17 +354,42 @@ __alias__() { alias gcm="git commit -m" alias gpu="git push --recurse-submodule=on-demand" gsu() { - echo "-- pulling submodules --" - git submodule foreach git pull --recurse-submodule - echo "-- updating submodules --" - git submodule update --init --recursive - git diff . && - git add . - sleep 0.3 - git commit -m " update: submodules" - git push && - echo "push successfull" + echo_info "Pulling submodules..." + if git submodule foreach git pull --recurse-submodule; then + echo_info "Submodules pulled successfully." + else + echo_error "Failed to pull submodules." + return 1 + fi + echo_info "Updating submodules..." + if git submodule update --init --recursive; then + echo_info "Submodules updated successfully." + else + echo_error "Failed to update submodules." + return 1 + fi + + if git diff .; then + echo_info "Staging changes..." + git add . + sleep 0.3 + if git commit -m " update: submodules"; then + echo_info "Changes committed successfully." + else + echo_error "Failed to commit changes." + return 1 + fi + else + echo_info "No changes to commit." + fi + + if git push; then + echo_info "Push successful." + else + echo_error "Failed to push changes." + return 1 + fi } gwip() { # Fetch the latest changes from the remote