Git: How to get all changed files between revisions even if they where reverted between the revisions

Viewed 60

I use something like git diff --name-only 'HEAD@{2 days ago}' HEAD to get the Files changed between the revisions.

My Problem here is, that if between this releases a File was changed and reverted, it will not be listed by this command. I need to know which files where changed even if they where reverted, how can I do that?

I need this for building releases. If a release fails in a test-Environment because a script is applied with errors and the file is reverted to stable state, then if I would create a new release this script will not be inside and will not be executed and the wrong content will be still in my test-Environment. I will have to execute the script manually. It would not have impact to systems where the failing Release was applied, but my test-Environment would not be in the same state as all the others.

1 Answers

Make a list of all files changed by each commit, then pipe that to | sort | uniq:

for rev in $(git rev-list HEAD~4..HEAD); do
  git diff --name-only $rev~ $rev
done | sort | uniq
Related