Skip to content

Instantly share code, notes, and snippets.

@drewsberry drewsberry/gitjekgit.sh
Last active Nov 26, 2015

Embed
What would you like to do?
Useful Jekyll + Git Bash scripts
#!/bin/bash
# Run this scrript in the root directory of your Jekyll source
# repository for your GitHub page, and it will commit and push
# the source to origin/source, then build, commit and push the
# resuling HTML to your origin/master, i.e. your website. The
# commit message for both commits is given by the first
# argument.
if [[ -z "$1" ]]; then
echo "Please enter a git commit message."
exit
fi
git checkout source && \
git add . && \
git commit -am "$1" && \
git push origin source && \
echo "Source successfully pushed to GitHub."
jekyll build && \
touch _site/.nojekyll && \
cd _site && \
git add . && \
git commit -am "$1" && \
git push origin master && \
cd .. && \
echo "Site successfully build and pushed to GitHub."
#!/bin/bash
# Run this script in the root directory of your repo, and it will
# add everything to the commit, commit it with message given by the
# first argument and push it to the remote branch given by the second
# argument
if [[ -z "$1" ]]; then
echo "Please enter a commit message."
exit 5
fi
if [[ -z "$2" ]]; then
echo "Please enter a remote branch."
exit 10
fi
git add . && \
git commit -am "$1" && \
git push origin $2 && \
echo "Successfully pushed to origin/$2."
#!/bin/bash
# Run this script in the root directory of your Jekyll source
# repository for your GitHub page, and it will build your site
# and push the resulting HTML to your remote master branch,
# i.e. to your site, with commit message given by the first
# argument
if [[ -z "$1" ]]; then
echo "Please enter a git commit message"
exit
fi
jekyll build && \
touch _site/.nojekyll && \
cd _site && \
git add . && \
git commit -am "$1" && \
git push origin master && \
cd .. && \
echo "Successfully built and pushed to GitHub."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.