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 and sleeptime 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:

Back to Top ↑