Merge pull request #44 from bmoffit/feature-status_check

status check before add and commit
pull/50/head
Dave Musicant 6 years ago committed by GitHub
commit 29bd1079d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -176,9 +176,12 @@ while true; do
FORMATTED_COMMITMSG="$(sed "s/%d/$(date "$DATE_FMT")/" <<< "$COMMITMSG")" # splice the formatted date-time into the commit message
fi
cd $TARGETDIR # CD into right dir
$GIT add $GIT_ADD_ARGS # add file(s) to index
$GIT commit $GIT_COMMIT_ARGS -m"$FORMATTED_COMMITMSG" # construct commit message and commit
STATUS=$($GIT status -s)
if [ -n "$STATUS" ]; then # only commit if status shows tracked changes.
$GIT add $GIT_ADD_ARGS # add file(s) to index
$GIT commit $GIT_COMMIT_ARGS -m"$FORMATTED_COMMITMSG" # construct commit message and commit
if [ -n "$PUSH_CMD" ]; then $PUSH_CMD; fi
if [ -n "$PUSH_CMD" ]; then $PUSH_CMD; fi
fi
done

Loading…
Cancel
Save