From ed67cd583530593afa80e2c70b5516e4db47c32c Mon Sep 17 00:00:00 2001 From: sthope Date: Sun, 24 Jul 2022 00:57:40 +0200 Subject: [PATCH] git --- docs/cmnds/git.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/cmnds/git.md diff --git a/docs/cmnds/git.md b/docs/cmnds/git.md new file mode 100644 index 0000000..b7f0c58 --- /dev/null +++ b/docs/cmnds/git.md @@ -0,0 +1,26 @@ +### git push script + +``` +#!/bin/sh + +# If a command fails then the deploy stops +set -e + +# Confirm with user +read -n 1 -p "Push to GitHub? (enter or ctrl+c):" input + +printf "\033[0;32mDeploying updates to GitHub...\033[0m\n" + +# Add changes to git +git add . + +# Commit changes +msg="rebuilding site $(date)" +if [ -n "$*" ]; then + msg="$*" +fi +git commit -m "$msg" + +# Push source +git push origin master +``` \ No newline at end of file