0

I would like to create some derived data after doing a pull from GitHub. The repo may have none or many items that need to be built based on what has changed, so I would like to be selective. My first thought was to use a Makefile and a post-merge hook, but unless I am totally missing something make will not work since all the timedate stamps will be meaningless after the pull.

My next thought, based on this answer, is to analyze the results of git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD in a post-merge hook and take action based on that analysis.

This seems like something that should come up often but I have not seen recommend idiomatic approach to this. Does anyone know of know of such an approach or have a better recommendation? The answer I am referencing is almost 10 years old

Update

Quentin's comment made me realize the part I was totally missing was that pull does not alter the time / date stamps of files that are not changed. I must have been thinking about after a clone. So I guess make should work. The times and dates may not match the time and date of the actual file change but will reflect when they were pulled, so I think make still is an option.

nPn
  • 16,254
  • 9
  • 35
  • 58
  • 1
    That solution sounds good to me, what do you dislike about it? Edit: actually, the simple `make` solution should work since Git will not touch unchanged files. – Quentin Mar 11 '22 at 18:58
  • hmmm ... @Quentin I guess I was missing something. I must have been thinking about when you do a clone all the files are get the time / date stamp of the time the clone was created, so I guess make should work. – nPn Mar 12 '22 at 14:27

0 Answers0