#!/bin/bash
#
# gitwait - watch file and git commit all changes as they happen
#
while true; do
inotifywait -qq -e CLOSE_WRITE ~/.calendar/calendar
cd ~/.calendar; git commit -a -m 'autocommit on change'
done
<?
$r = $_GET['r'];
if (!empty($c)) {
//use system instead of exec if you want the output to go back to the git client
exec("cd /path/to/repo/parent/$r; sudo git reset --hard HEAD; sudo git pull;");
echo "\n\nServer: Updated\n\n";
} else {
echo "\n\nServer: UPDATE FAILED\n\n";
}
?>
# While running, monitors the specified directory, and when a file therein
# is created or edited and saved, this prompts the user for a commit message.
# The --exclude is to avoid extra prompts for the changes made to
# version control directories.
# requires inotify-tools
inotifywait --exclude '/\..+' -m path/to/directory -e modify -e create |
while read path action file; do
gnome-terminal -e 'bash -c "cd path/to/directory;
git add *;
echo What did you just do??;
read varname;
git commit -m \"$varname\""'
done