Reputation: 5078
Is it possible to set Git up in a way that it will tell me when a choice file(s) has been modified. I would like this to be setup similarly to a git hook, but I don't need to know when anything in the whole project has been changed only a choice file.
This is for a Java project that I am running in eclipse.
Edit I have been considering this and am wondering if it is possible to accomplish this without putting in a Git hook that all other developers will need to run. I realize that might not be possible, if it is not possible I will accept the more standard answer.
Upvotes: 1
Views: 79
Reputation: 1567
You can hook the whole directory (e.g. pre commit), and then filter to get just the file(s) you want.
my_files=$(git status --short | grep -E '^(A|M)' | awk '{ print $2 }' | grep -E 'WhateverPatternYouNeed\.php$')
for file in $my_files; do
# Do something...
done
Of course your "do-something" can make a curl call to text you, email, etc.
Upvotes: 2