Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

##Mac GitWatch

Based heavily on:

This watches the list of dirs in $repos. Remove mine and add your own. It will watch for changes and then commit and push the result.

To make this run and stay alive, you have to use automator to make an Application script.


Here's a screenshot of what I did:

Then you can run this app on login with the plist below.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
cd "$1" && git add . && git commit -m "unattended" && git push
# PATH for launchd to find `fswatch`
export PATH="/usr/local/bin:$PATH"
for repo in ${repos[*]}
echo $repo
fswatch -r "$repo" | (sleep $sleeptime; grep --line-buffered -v '\/.git\/';) | xargs -n1 -I{} /Users/Jeremy/bin/ "$repo" &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment