I am trying to setup CI/CD in a way that it kicks off testing only on files that have been added/touched. Essentially the work flow is as follows:
A developer creates a branch from the production branch to test changes.
They make certain changes, test locally, and then merge into the production branch.
But, because there are various developers continuously merging changes, by the time you merge your changes there may be new directories or files in production.
So the following command would return changes between the development branch and the master branch while including whatever is missing on both sides:
git diff {my_development_branch} {master} --name-only -r
Let's assume I have these files in master:
A/file1
B/file2
C/file3
and I create a branch called my_development_branch
which contains the same but now I have added a directory and file:
A/file1
B/file2
C/file3
D/file4
By this point the master branch may have new contents so it may look like:
A/file1
B/file2
C/file3
Z/file26
Using git diff
will return D and Z but for my use cases I would like to only get files that I have added/touched which would only be D. Is there a way to get git to discern this information for me?