git_sync/sync.sh
2025-01-11 17:18:03 +03:00

20 lines
393 B
Bash
Executable File

# Check for updates in remote repo
git pull
# Update at the start (we don't know if file changed)
git add *
git commit -m 'sync'
git push
while true
do
#last_changed=$(find . -mmin -1)
# Update if file changed 10 seconds ago
last_changed=$(find . -newermt "10 seconds ago" | grep -v .git)
if [ "$last_changed" != "" ]; then
git add *
git commit -m 'sync'
git push
fi
sleep 5
done