summaryrefslogtreecommitdiff
path: root/.a/git-autocommit.sh
blob: f969509f719e05d70d1b4e62766147f4fc295b2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

TIME_SCALE=60    # In seconds
TIME_INTERVAL=5 # Multiplier of TIME_SCALE


ACCUMULATOR=0
while true; do
	if ! ((ACCUMULATOR % TIME_INTERVAL)) && [[ `git status --porcelain` ]]; then
		MSG="Autocommit at $(date +'%d.%m.%Y @ %H:%M')"

		git add . && git commit -m "$MSG" && git push

		echo $MSG
	fi

	sleep $TIME_SCALE
	((ACCUMULATOR++))
done