1

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.

5
  • @SparshKhandelwal choice file(s) = one or more files in a project. For example if I wanted to know every time some developer pushed a change to a controller or a config file. How would I do this in an automated way? Commented May 8, 2015 at 17:43
  • How would you want to be notified? Commented May 8, 2015 at 17:58
  • @chepner email would be my first choice, but other conventional methods like RSS would be fine. Commented May 8, 2015 at 18:16
  • Did you ever encounter an alternative solution? Commented Jun 2, 2015 at 1:00
  • @Scott'scm6079' thanks for doubling back! I never found an alternative way. Seems like a CI solution like Jenkins might be possible though I have not had the time to devote. Until such time as a better solution is found I'm going with your answer. Commented Jun 2, 2015 at 4:00

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.