Skip to content

Instantly share code, notes, and snippets.

@jackprophesy
Created September 28, 2009 20:07
Show Gist options
  • Save jackprophesy/195805 to your computer and use it in GitHub Desktop.
Save jackprophesy/195805 to your computer and use it in GitHub Desktop.
#!/bin/bash
## options to be accepted
optstr=m:dv ## colon follows options that require an argument
while getopts $optstr var
do
case $var in
v) verbose="-v" ;;
d) deploy=1;;
m) message=$OPTARG ;;
esac
done
shift $(( $OPTIND - 1 ))
verbose=${verbose:-"-q"}
deploy=${deploy:-0}
defaultmessage=${message:-"No commit message provided"}
if [ $verbose = "-v" ]; then
echo -e 'Adding updated files to commit...'
git add -Av
echo -e 'Committing...'
git commit -a -m "$defaultmessage" -v
echo -e 'Pushing to origin master...'
git push -v origin master
else
echo -e 'Adding updated files to commit...'
git add -A
echo -e 'Committing...'
git commit -a -q -m "$defaultmessage"
echo -e 'Pushing to origin master...'
git push origin master
fi
if [ $deploy = 1 ]; then
echo -e 'Deploying...'
if [ $verbose = "-v" ]; then
cap deploy -v
else
cap deploy -q
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment