✏️ Used different approach for multiple remotes

This commit is contained in:
z3rOR0ne 2022-08-05 02:49:25 -07:00
parent 32f82f3031
commit e618f80155

View file

@ -250,7 +250,7 @@ if [ $numrepos -eq 0 ] ; then
else else
# creates a list of repos and puts them in an array # creates a list of repos and puts them in an array
remotearray=($(git remote)) # remotearray=($(git remote))
# Grabs all new files # Grabs all new files
newfiles=$(git status --short | grep '??' | awk '{print $2}' | tr '\n' ' ') newfiles=$(git status --short | grep '??' | awk '{print $2}' | tr '\n' ' ')
# Grabs all modified files # Grabs all modified files
@ -296,9 +296,10 @@ else
git reset --hard ${commitarray[$version]} git reset --hard ${commitarray[$version]}
# and pushes it to remote repository # and pushes it to remote repository
for ((i = 0; i < numrepos; i++)) ; do git remote | xargs -L1 git push --all
git push --force ${remotearray[i]} ; # for ((i = 0; i < numrepos; i++)) ; do
done # git push --force ${remotearray[i]} ;
# done
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}" echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
exit 0 exit 0
@ -399,9 +400,10 @@ else
git commit -m "$gitmoji $cmessage" ; git commit -m "$gitmoji $cmessage" ;
# pushes the commit to each repository # pushes the commit to each repository
for ((i = 0; i < numrepos; i++)) ; do git remote | xargs -L1 git push --all
git push ${remotearray[i]} ; # for ((i = 0; i < numrepos; i++)) ; do
done # git push ${remotearray[i]} ;
# done
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}" echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
exit 0 exit 0