You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
731 B

# git autocommit and push
# use git caching or ssh key auth
# git config --global credential.helper cache
# git config --global credential.helper 'cache --timeout=3600'
if test "$#" -ne 1; then
echo "Target dir is required!"
exit 1
# check if TARGETDIR is a valid git repository
if git -C $TARGETDIR rev-parse; then
function scan_and_commit () {
git diff --name-only > /tmp/gaap_files
n=$(wc -l /tmp/gaap_files | awk '{print $1}')
if test $n -ne 0; then
while read file; do
git add "$file"
done < /tmp/gaap_files
git commit -m "autocommit $(date)"
git push
rm /tmp/gaap_files
export -f scan_and_commit
watch -n 10 scan_and_commit