Auto sync GIT repos in MAC
Use the following to auto-commit your changes in git repo. The commit will include the file changed. You can control the monitor interval by changing the variable sleeptime
in git-commit-repos.sh
. All the git operations are logged in /tmp/gitwatch-commit.log
.
Use cases:
- syncing your notes repository automatically eg. Sublime ZK
Requirements:
Steps:
- Make sure all the required softwares are installed
- Place these 2 scripts in suitable folder
- Change the
repo
andsleeptime
as required. - Run the
git-commit-repos.sh
script on login via launchctl or automator. - Check if working via
tail -f /tmp/gitwatch-commit.log
bash -x git-commit-repos.sh
Sources:
- https://github.com/gitwatch/gitwatch
- https://gist.github.com/glassdimly/eadbf7da77549c49e55859b370bb9f7e
- https://szymonkrajewski.pl/automatic-file-versioning-after-change-using-fswatch-and-git/
- https://serverfault.com/a/103569