Skip to content

Instantly share code, notes, and snippets.

@rjray
Created May 3, 2009 12:41
Show Gist options
  • Save rjray/105977 to your computer and use it in GitHub Desktop.
Save rjray/105977 to your computer and use it in GitHub Desktop.
#!/bin/bash
# I use this to create a gh-pages branch on new repos
if [ ! -d .git ]; then
echo "Must be in a repository directory!"
exit
fi
wd_clean=$(git status | grep 'nothing to commit')
if [ "x$wd_clean" == "x" ]; then
echo "Uncommitted changes detected, cannot continue"
exit
fi
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "Placeholder" > index.html
git add .
git commit -a -m "Establish gh-pages branch"
git push origin gh-pages
git checkout master
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment