git/list[1] front-page[2] threads[3] people[4] search[5] about
 

How to watch files in a Git repository

From
RDR. Diez <rdiez1999@gmail.com>
Date
Jun 6, 2022, 16:04 UTC
Message-ID
<68627d29-8ffd-2e22-46ca-c28c9e980177@gmail.com>
Hi all:
I would like to get a notification e-mail when certain files or directories change in a Git repository.
In the good old CVS days, you could just 'watch' a file with your favourite CVS GUI.
Some online services like GitHub offer their own notification mechanism, but I would like something generic. I am not looking for a hook solution, because the Git repositories may not be mine, so I may only have read access.
The idea is that I can set up a cron job to periodically pull a repository, and run a script to generate the e-mails from the commit history. Any new commits which match the desired branch and modify the desired files and/or directories would trigger the notifications.
I've searched the Web, but couldn't find anything straightforward.
If there is nothing of the sort, I could write my own script in Bash or Perl. I can handle cron and sending e-mails, but I do not know much about Git's internals. Could someone provide a few pointers about how to code this? I would expect there is some command to list commits, and all files touched by a particular commit. And there would be some way to interface with Bash or Perl, which does not need parsing complicated text output from Git.
Thanks in advance,
   rdiez
Next: Jeff King
Message 1 of 5 in “How to watch files in a Git repository”
  1. R. DiezJun 6, 2022
  2. Jeff KingJun 8, 2022
  3. rsbecker@nexbridge.comJun 9, 2022
  4. Jeff KingJun 9, 2022
  5. Son Luong NgocJun 9, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.