Last active
December 14, 2020 03:03
-
-
Save drewsberry/1b9fc80682edd8bcecc4 to your computer and use it in GitHub Desktop.
Useful Jekyll + Git Bash scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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