#!/bin/bash #Scripts to detect and push changes if exist; Runs in Git direcories, called by GitDaemon script. source ~/.bash_profile > /dev/null source ~/.zshrc > /dev/null #Exclude directories with the .noautocommit file; if [[ -f .autocommit ]]; then if [[ -z $(git status | grep "nothing") ]]; then #If working state is not clean - assume dirty directory echo "[git]: Directory $(pwd) has changes uncommited to git. Adding changes..." git add . -A #Adds only essentials via reverse gitignore echo "[git]: Committing changes..." git commit -m "Scripted commit - $(date)" git push >/dev/null 2>&1 elif [[ -n $(git status | grep "nothing") ]]; then echo "[git]: Directory has no uncommited changes." > /dev/null fi fi