#!/bin/bash

# this code adapted from
# http://stackoverflow.com/questions/1811730/how-do-you-work-with-a-git-repository-within-another-repository

# set my home directory
export HOME=/home/aaron

# where the github.io repo is cloned to
cd /home/aaron/git/github.io/

# set some git settings, since they may not be inherited
git config user.email "aaron@virginia.edu"
git config user.name "Aaron Bloomfield"
git config push.default simple

# pull the github.io repo
echo Pulling github.io...
git pull
/bin/echo

# update each submodule
echo Updating all the submodules...
git submodule update --recursive --remote
/bin/echo

# commit any changes
echo Commiting changes to the github.io repo...
git commit -a -m"Automated propagation of changes from a submodule to my github.io page"
/bin/echo

# push the updated github.io repo
echo Pushing changes to github...
git push
/bin/echo

echo "All done!"