Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 30 lines (29 sloc) 710 Bytes
#!/bin/bash
if [ $# -eq 0 ]; then
echo "USAGE: $0 <files>" >&2
exit 1
fi
if ! git diff --quiet; then
echo >&2
echo "ERROR: working tree is dirty; aborting..." >&2
echo >&2
exit 2
fi
if ! git diff --quiet --cached; then
echo >&2
echo "ERROR: index is dirty; aborting..." >&2
echo >&2
exit 2
fi
HEAD=`git symbolic-ref HEAD`
SHA=`git rev-parse HEAD`
git symbolic-ref HEAD refs/heads/gh-pages || exit $?
mv .git/index .git/index.old || exit $?
git add -f "$@" || exit $?
if git diff --quiet --cached; then
echo "nothing to commit..."
else
git commit -m "build from $SHA" || exit $?
fi
git symbolic-ref HEAD "$HEAD" || exit $?
mv .git/index.old .git/index || exit $?