29 lines
511 B
Plaintext
29 lines
511 B
Plaintext
|
#!/bin/sh
|
||
|
# Simple wrapper script around git to easily push an update
|
||
|
|
||
|
COMMIT_MSG=${1}
|
||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||
|
FILES=("${@}")
|
||
|
|
||
|
printf "Checking if Git repository is present...\n"
|
||
|
|
||
|
git rev-parse --is-inside-work-tree
|
||
|
if [ "$?" != 0 ]; then
|
||
|
printf "Not a Git repository.\n"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ "${FILES}" = "" ]; then
|
||
|
printf "No files added.\n"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ "${COMMIT_MSG}" = "" ]; then
|
||
|
printf "No commit message.\n"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
git add ${FILES}
|
||
|
git commit -m ${1}
|
||
|
git push origin ${BRANCH}
|