Created
March 7, 2017 07:39
-
-
Save msawangwan/85ee7ffbedde3d1eb5a599d06a0ded9b to your computer and use it in GitHub Desktop.
[bash] git auto add-commit-push
This file contains hidden or 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 -x | |
REQ_ARGS=2 | |
BAD_ARGS_EXIT=65 | |
if [ $# -ne $REQ_ARGS ]; then | |
echo | |
echo "usage: `basename $0` REPOSITORY BRANCH" | |
echo | |
exit $BAD_ARGS_EXIT | |
fi | |
echo | |
echo "**AUTO COMMIT PROCESS**" | |
echo | |
REPO=$1 | |
BRANCH=$2 | |
MESSAGE=$3 | |
if [[ $3 == "" ]]; then | |
MESSAGE="all: auto commit" | |
fi | |
echo | |
echo "**REPO: $REPO BRANCH: $BRANCH**" | |
echo "**MESSAGE: $MESSAGE**" | |
echo | |
git status | |
git add . | |
git status | |
git commit -m "$MESSAGE" | |
git status | |
git push $REPO $BRANCH | |
git status | |
git remote show $REPO | |
echo | |
echo "**AUTO COMMIT COMPLETE**" | |
echo "**PUSHED TO REPO [$REPO] BRANCH [$BRANCH]**" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment