All Projects → oxplot → Gitwatch

oxplot / Gitwatch

Licence: mit
Watch a git repository for changes

Programming Languages

shell
77523 projects

gitwatch lets you watch a git repository for changes and run a custom command per change. I wrote this to keep track of certain Cyanogenmod features.

Here is an example of how you might use gitwatch to get notified of changes to btrfs code in linux kernel:

gitwatch https://github.com/torvalds/linux.git master \
  grep -Pq "'"'^[+-]{3}.*/fs/btrfs/'"'" '&&' echo '$GW_TO' '|' mail -s btrfs mike

gitwatch runs grep ... once for each new change since the last time it was run. If it's the first time, it will only clone the repo without running the command. The command is fed the output of git diff. $GW_TO is the commit that introduced the change. Some other environmental variables are also set (see the comment on top of the script).

Let's install an hourly cron job on the hour to automate this:

(crontab -l; echo -n '0 * * * * '; cat <<-EOF | tr '\n' ' '; echo) | crontab

  gitwatch https://github.com/torvalds/linux.git master 
    grep -Pq "'"'^[+-]{3}.*/fs/btrfs/'"'" '&&' echo '\$GW_TO' '|' mail -s btrfs mike
    2>/dev/null

EOF
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].