gitwatch
Automatically commit changes when files are modified
TLDR
SYNOPSIS
gitwatch [options] path
DESCRIPTION
gitwatch watches a directory and automatically commits changes whenever files are modified. It uses inotifywait (on Linux, via inotify-tools) or fswatch (on macOS/BSD) to detect file changes in real time, then waits a short delay before committing so rapid successive edits are batched into a single commit.The tool is useful for automatic version control of notes, configuration files, or any directory where you want every change tracked without manual commits, and can optionally push each commit to a remote.
PARAMETERS
-s seconds
Delay before committing after a change is detected (default: 2).-d format
Timestamp format string used in the default commit message (see `man date`).-r remote
Remote to push to after each commit (default: no push).-R
Run `git pull --rebase` before pushing.-b branch
Branch to push commits to.-g path
Location of the `.git` directory (auto-detected by default).-m message
Commit message template; `%d` is replaced with the timestamp.-c command
Command whose output is used as the commit message instead of `-m`.-C
Pipe the list of changed files to the `-c` command via stdin.-l lines, -L lines
Include changed lines in the commit message, colored (`-l`) or uncolored (`-L`); `0` includes all lines.-e events
inotifywait events to monitor for changes.-x pattern
Exclude paths matching pattern from being watched.-f
Commit any pending changes immediately on startup.-M
Skip auto-committing while a git merge is in progress.-v
Verbose/debug output.-h
Display help message.
INSTALL
CAVEATS
Requires inotify-tools on Linux or fswatch on macOS/BSD to be installed. Only tracks changes gitwatch itself observes while running; it does not replay changes made while it was stopped.
SEE ALSO
inotifywait(1), git(1)