Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (28 sloc) 782 Bytes
source=$1
if [ -z "$source" ]; then
echo "Source was not specified"
exit 0;
fi
message=$2
: ${message:="$(curl -s whatthecommit.com/index.txt)"}
[ -z $(git config user.name) ] && git config --global user.name $(git log -1 --pretty=%an)
[ -z $(git config user.email) ] && git config --global user.email $(git log -1 --pretty=%ae)
origin=$(git config --get remote.origin.url)
exists=$(git ls-remote --heads ${origin} gh-pages)
if [ -z "$exists" ]; then
mkdir -p GHPAGES_DIR
cp -r .git GHPAGES_DIR
cd GHPAGES_DIR
git checkout -b gh-pages
else
git clone -b gh-pages --single-branch $origin GHPAGES_DIR
cd GHPAGES_DIR
fi
ls | grep -v CNAME | xargs rm -rf
cd ../
cp -R ${source} GHPAGES_DIR
cd GHPAGES_DIR
git add .
git commit -m "$message"
git push origin gh-pages
cd ../
You can’t perform that action at this time.