I\'d like to use git to record all the changes to a file.
Is there a way I can turn git \'commit\' on to automatically happen every time a file is updated - so ther
This does not satisfy the "Ideally" part of the question, but this was the closest question I saw to the answer I wanted, so I figured it could go here. My first stackoverflow post though, so apologies if I'm mistaken.
The following script ensures automatic commits on saved changes, but does prompt the user for commit input. (I realise my scenario is a little different to git-noob's).
# 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