fix gsu
This commit is contained in:
parent
4961cf01b0
commit
78d44ea65a
1 changed files with 19 additions and 15 deletions
34
.zshrc
34
.zshrc
|
@ -354,23 +354,26 @@ __alias__() {
|
|||
alias gcm="git commit -m"
|
||||
alias gpu="git push --recurse-submodule=on-demand"
|
||||
gsu() {
|
||||
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 "| git submodule foreach git pull --recurse-submodule |"
|
||||
git submodule foreach git pull --recurse-submodule &&
|
||||
echo "-- pulled down submodules recursively"
|
||||
|
||||
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
|
||||
echo "| git submodule update --init --recursive |"
|
||||
git submodule update --init --recursive
|
||||
|
||||
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..."
|
||||
git add .
|
||||
sleep 0.3
|
||||
|
@ -391,6 +394,7 @@ __alias__() {
|
|||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
gwip() {
|
||||
# Fetch the latest changes from the remote
|
||||
git fetch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue