$ brew install fswatch
A command line here is an example.
$ cd <the root of the local git repository>
$ fswatch -0 . -l 10 -e "\\.git.*" | xargs -0 -n 1 -I{} sh -c 'git add .; git commit --author="Author automatic <author@users.noreply.github.com>" -m "auto commit changes.";'
- Don't use
git commit -am
because -a doesn't treat a new file. - Better to put .gitignore first to prevent exhaustive detection.
- Better to create a branch for this auto committing because the commit history gets messy about.
- Set a latency not to commit too sensitive changes, e.g.
-l 10
.