bonfire-app/git-publish.sh

32 lines
502 B
Bash
Raw Normal View History

2021-04-20 13:07:54 +00:00
#!/bin/bash
DIR="${1:-$PWD}"
echo Checking for changes in $DIR
cd $DIR
2021-04-30 11:21:25 +00:00
git add .
2021-04-20 13:07:54 +00:00
set +e # Grep succeeds with nonzero exit codes to show results.
2021-04-30 11:35:06 +00:00
2021-04-20 13:07:54 +00:00
if git status | grep -q -E 'modified|ahead'
then
set -e
2021-04-23 06:59:06 +00:00
git config core.fileMode false
# have to add/commit before being able to rebase
git commit -a
# fetch and rebase remote changes
git pull --rebase
echo Publishing changes!
2021-04-20 13:07:54 +00:00
git push
2021-04-23 06:59:06 +00:00
2021-04-20 13:07:54 +00:00
else
set -e
2021-04-23 06:59:06 +00:00
#echo No local changes since last run
git pull
2021-04-20 13:07:54 +00:00
fi