Shell script to change files content on multiple git repository

Continuing last post, change content in multiple files, I made another script to change multiple files on each git repository and push the code.

1. Make folder list in array

#!/bin/sh

array=( site1 site2 site3 )

2. For each loop for each sites

for site in "${array[@]}"
do
  #some command
done

3. Replace content in each file

cd ~/home/"$site"/
rpl ".title" ".h1_title" ~/home/"$site"/css/common.css

4. Commit the changes

git pull
git add .
git commit -am 'title changed to h1 title on css file'
git push

5. This is the final code.

#!/bin/sh

array=( site1 site2 site3 )

for site in "${array[@]}"
do
  cd ~/home/"$site"/
  rpl ".title" ".h1_title" ~/home/"$site"/css/common.css
  git pull
  git add .
  git commit -am 'title changed to h1 title on css file'
  git push
done

This is especially useful when I have many sites with same structure.