65

For example, https://github.com/vanillaforums/Garden is the GitHub repository. But I only want to 'watch' this directory https://github.com/vanillaforums/Garden/tree/master/plugins in the repository.

How do I do that? There doesn't seem to be a way.

its_me
  • 10,998
  • 25
  • 82
  • 130

6 Answers6

89

GitHub provides feeds that can do this for both directories and files.1 Using that syndication, a service like Blog Trottr can send you an email whenever the feed is updated.

Some samples, taken from the Linux source code on master:

Directory File
Source on GitHub /Documentation /Documentation/Makefile
History on GitHub /Documentation /Documentation/Makefile
History Atom feed /Documentation /Documentation/Makefile

1 Thank you, youfu.

Michael
  • 8,362
  • 6
  • 61
  • 88
jarv
  • 5,338
  • 24
  • 26
  • 5
    For private repository according to http://stackoverflow.com/questions/7353538/setting-up-an-github-commit-rss-feed?noredirect=1&lq=1 you need to add parameter token=your-token – Michael Freidgeim Sep 11 '16 at 21:17
  • 1
    Note that for some files, you just get a cute little _"Sorry, this feed is taking too long to generate."_ – Michael Sep 08 '17 at 13:35
  • 4
    It worth mention that the `.atom` trick also works for a single file. – youfu Jan 07 '20 at 09:14
13

I can't think of anything if you really need to watch a directory. But if you can get away with a single file, you can use a change tracker like VisualPing1 on the raw view of the file in question. The directory view would probably change every time someone starred or watched the project, but a single file should be sufficient for a lot of people (especially with Makefile.am / CMakeLists.txt / etc. which list all subdirectories).

1 No particular endorsement. They bought the service I was using before.

Michael
  • 8,362
  • 6
  • 61
  • 88
nemequ
  • 16,623
  • 1
  • 43
  • 62
9

I confirm that the "watch" feature on GitHub is at the repository level, not at the directory level.

For directory-level watching, you could implement it by, for instance, having a local process cloning, then pulling, that repo every x hours, checking the ls-tree of each new commit, and then sending you an email if an update in plugins is detected.

Lucas
  • 523
  • 2
  • 10
  • 20
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 3
    Would that be lots of code? If not, can you kindly, put the how-to in your answer? – its_me Mar 16 '12 at 08:47
  • @badlearner: I would implement it as a post-receive hook along the lines of "[Git: Which commit has this blob?](http://stackoverflow.com/questions/223678/git-which-commit-has-this-blob)" – VonC Mar 16 '12 at 08:49
3

You could follow the commit page with some website that tracks changes on sites. For example I'm using Follow That Page for the history of a file on ActiveAdmin's github.

Michael
  • 8,362
  • 6
  • 61
  • 88
Alexis
  • 4,836
  • 2
  • 21
  • 27
  • 1
    yup, works as expected, just make sure to mark "skip numbers" to don't get notify whenever someone forks o gives a star, regards! – Alexis Nov 01 '15 at 19:19
3

I just found out this service: https://app.github-file-watcher.com/

Watching a repository on GitHub tells you about social activity (e.g. PRs, issues, etc.), but it doesn't let you know about file-level changes you might care about (e.g. changes to an internal API you're abusing, to a SQL structure, to a dependencies file).

GitHub File Watcher fills that gap. Just enter your email, the GitHub repository you want to track, and what files you want notifications for. When they change, you get an email.

I don't know yet if it works, will start using now.

fiatjaf
  • 11,479
  • 5
  • 56
  • 72
1

I'll post an alternative that involves a combo of GitHub plus email filters:

  • Setup emails for all PRs
  • Use a filter to do something with all those emails (for myself, I route them to "Social" in Gmail. You could just delete them, whatever)
  • Do ANOTHER filter (that wins out over the above one) looking for paths that interest you (Since every PR email has every changed file, you can look for folder paths), and route those emails somewhere else (maybe Primary (in Gmail))

Example:

M Dockerfile.nordic (2)
M firmware-nordic-nrf5x/README.md (2)
M jobs-container/firmware-nordic/build-nrf9160-dk.sh (2)

Maybe I want to see all changes to firmware-nordic-nrf5x/, so I'll filter on that

Alex E
  • 149
  • 9