[QUESTION] Help with a git pull script
- bobo5290461
- Crewman
- Posts: 32
- Joined: Mon Dec 11, 2017 12:52 pm
- Location: Lochristi
- Contact:
[QUESTION] Help with a git pull script
Hello,
Happy newyear everyone , good health and much arcolinuxF (Fun).
Because i'm not that strong in scripts but growing here's my question.
I have a directory ArcoLinuxB
Inside that directory I have Xfce and Cinnamon and Budgie and so on
Then in each one i have Max and Min where i put my Githubs
/ArcoinuxB/Xfce/Max
/ArcoliuxB/Xfce/Min
/ArcoLinuxB/Cinnamon/Max
/ArcolinuxB/Cinnamon/Min
and so on for every desktop
Now i have to go in each directory , open a terminal and do a git pull (26 iso's and counting....)
Can someone get me started to make 1 script that does it all in one time?
Happy newyear everyone , good health and much arcolinuxF (Fun).
Because i'm not that strong in scripts but growing here's my question.
I have a directory ArcoLinuxB
Inside that directory I have Xfce and Cinnamon and Budgie and so on
Then in each one i have Max and Min where i put my Githubs
/ArcoinuxB/Xfce/Max
/ArcoliuxB/Xfce/Min
/ArcoLinuxB/Cinnamon/Max
/ArcolinuxB/Cinnamon/Min
and so on for every desktop
Now i have to go in each directory , open a terminal and do a git pull (26 iso's and counting....)
Can someone get me started to make 1 script that does it all in one time?
Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.
- erikdubois
- Captain
- Posts: 1685
- Joined: Tue Nov 07, 2017 2:45 pm
- Location: Belgium
- Contact:
Re: [QUESTION] Help with a git pull script
This is what I use.
You can make it smaller with case structures or for loop but this does the job.
With copy/paste and search/replace it can be done very quickly.
Code: Select all
count=0
count=$[count+1]
tput setaf 1;echo "Github "$count;tput sgr0;
# if there is no folder then make one
[ -d $HOME"/ARCOLINUX/arcolinux-applications" ] || git clone https://github.com/arcolinux/arcolinux-applications
cd arcolinux-applications
git pull
echo "#################################################"
echo "################ "$(basename `pwd`)" done"
echo "#################################################"
cd ..
count=$[count+1]
tput setaf 1;echo "Github "$count;tput sgr0;
# if there is no folder then make one
[ -d $HOME"/ARCOLINUX/arcolinux-arc-themes" ] || git clone https://github.com/arcolinux/arcolinux-arc-themes
cd arcolinux-arc-themes
git pull
echo "#################################################"
echo "################ "$(basename `pwd`)" done"
echo "#################################################"
cd ..
count=$[count+1]
tput setaf 1;echo "Github "$count;tput sgr0;
# if there is no folder then make one
[ -d $HOME"/ARCOLINUX/arcolinux-awesome" ] || git clone https://github.com/arcolinux/arcolinux-awesome.git
cd arcolinux-awesome
git pull
echo "#################################################"
echo "################ "$(basename `pwd`)" done"
echo "#################################################"
cd ..
With copy/paste and search/replace it can be done very quickly.
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
- bobo5290461
- Crewman
- Posts: 32
- Joined: Mon Dec 11, 2017 12:52 pm
- Location: Lochristi
- Contact:
Re: [QUESTION] Help with a git pull script
So after good search, i found this.
And it does the trick. I have no idea if it's proper writen but it works.
Code: Select all
where="/mnt/7796ED7F6111804C/ARCOLINUX GIT/ArcoLinuxB/"
repos=(
"${where}/AWESOME/MAX/arco-awesome"
"${where}/AWESOME/MIN/arco-awesome-minimal"
"${where}/BSPWM/MAX/arco-bspwm/"
"${where}/BSPWM/MIN/arco-bspwm-minimal/"
"${where}/BUDGIE/MAX/arco-budgie"
"${where}/BUDGIE/MIN/arco-budgie-minimal"
"${where}CINNAMON/MAX/arco-cinnamon"
)
echo ""
echo "Getting latest for" ${#repos[@]} "repositories using pull --rebase"
for repo in "${repos[@]}"
do
echo ""
echo "****** Getting latest for" ${repo} "******"
cd "${repo}"
git pull --rebase
echo "******************************************"
done
Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.
- erikdubois
- Captain
- Posts: 1685
- Joined: Tue Nov 07, 2017 2:45 pm
- Location: Belgium
- Contact:
Re: [QUESTION] Help with a git pull script
great share
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
- erikdubois
- Captain
- Posts: 1685
- Joined: Tue Nov 07, 2017 2:45 pm
- Location: Belgium
- Contact:
Re: [QUESTION] Help with a git pull script
Code: Select all
git pull --rebase
Do you need it? Do you want?
I do not use it.
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
- bobo5290461
- Crewman
- Posts: 32
- Joined: Mon Dec 11, 2017 12:52 pm
- Location: Lochristi
- Contact:
Re: [QUESTION] Help with a git pull script
Indeed, i removed it.
I just a FULL PULL and it works great! So now i can spend more time for the fun stuff!!!!!!!!!!!!!!
I just a FULL PULL and it works great! So now i can spend more time for the fun stuff!!!!!!!!!!!!!!
Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.
- erikdubois
- Captain
- Posts: 1685
- Joined: Tue Nov 07, 2017 2:45 pm
- Location: Belgium
- Contact:
Re: [QUESTION] Help with a git pull script
Leave the boring part to the scripts
Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
- bobo5290461
- Crewman
- Posts: 32
- Joined: Mon Dec 11, 2017 12:52 pm
- Location: Lochristi
- Contact:
Re: [QUESTION] Help with a git pull script
Little update ,
in .bashrc-personal i made an alias
alias gitpull="find . -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev | xargs -I {} git -C {} pull"
So now in one move i can update all my directories and sub directories !!!
I know, i'm lazy.

in .bashrc-personal i made an alias
alias gitpull="find . -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev | xargs -I {} git -C {} pull"
So now in one move i can update all my directories and sub directories !!!
I know, i'm lazy.



Tx Anyone , Anywhere , Anyhow , Anytime , Anyway.
- erikdubois
- Captain
- Posts: 1685
- Joined: Tue Nov 07, 2017 2:45 pm
- Location: Belgium
- Contact:
Re: [QUESTION] Help with a git pull script
Yes you are
You can do anything with scripting
you gotta love it

You can do anything with scripting
you gotta love it


Learn, have fun and enjoy.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.
But first use the power of the Arch Wiki
use the tutorials on https://www.youtube.com/erikdubois
then use the power of google
and only then use the power of our moderators.