fix some things
This commit is contained in:
parent
f7019152eb
commit
16ae092321
1 changed files with 27 additions and 18 deletions
45
.zshrc
45
.zshrc
|
@ -354,38 +354,43 @@ __alias__() {
|
|||
alias gcm="git commit -m"
|
||||
alias gpu="git push --recurse-submodule=on-demand"
|
||||
gsu() {
|
||||
echo "| git submodule foreach git pull --recurse-submodule |"
|
||||
echo "${YELLOW}${BOLD}| git submodule foreach git pull --recurse-submodule |${NC}"
|
||||
git submodule foreach git pull --recurse-submodule &&
|
||||
echo "-- pulled down submodules recursively"
|
||||
echo "${CYAN}-- pulled down submodules recursively${NC}"
|
||||
|
||||
echo "| git submodule update --init --recursive |"
|
||||
git submodule update --init --recursive
|
||||
echo "${YELLOW}| git submodule update --init --recursive |${NC}"
|
||||
git submodule update --init --recursive &&
|
||||
echo "${CYAN}-- updated submodules recursively${NC}"
|
||||
|
||||
echo "-- Checking submodule branches... --"
|
||||
echo "${YELLOW}-- Checking submodule branches... --${NC}"
|
||||
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..."
|
||||
echo "${RED}Submodule $name is detached. Checking out $default_branch...${NC}"
|
||||
git checkout $default_branch
|
||||
else
|
||||
echo "Submodule $name is on branch $branch."
|
||||
echo "${CYAN}Submodule $name is on branch $branch.${NC}"
|
||||
fi
|
||||
'
|
||||
|
||||
if git diff --quiet .; then
|
||||
echo_info "Staging changes..."
|
||||
git add .
|
||||
sleep 0.3
|
||||
if git commit -m " update: submodules"; then
|
||||
echo_info "Changes committed successfully."
|
||||
gUpdateModules() {
|
||||
if git diff --quiet .; 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_error "Failed to commit changes."
|
||||
return 1
|
||||
echo_info "No changes to commit."
|
||||
fi
|
||||
else
|
||||
echo_info "No changes to commit."
|
||||
fi
|
||||
}
|
||||
|
||||
gUpdateModules
|
||||
|
||||
if git push; then
|
||||
echo_info "Push successful."
|
||||
|
@ -393,6 +398,10 @@ __alias__() {
|
|||
echo_error "Failed to push changes."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# gUpdateModules
|
||||
|
||||
error_log
|
||||
}
|
||||
|
||||
gwip() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue