2

Given two tagged releases in a Git repo, is it possible to list the files that were either added or removed?

For example, suppose tagged release 1.0 has a number of header and implementation files. Further suppose foo.h was removed and and bar.h was added; and then the collection was subsequently tagged as 2.0. How can I have Git tell me foo.h was removed and bar.h was added from 1.0 to 2.0?


EDIT: I only need to check between consecutive tags. That is, I only need to check between 1.0/2.0; 2.0/3.0; etc. I don't need to span multiple tags.

The reason I want to perform the check is we noticed distros were not always picking up new files for their [DEB|RPM] Build system. So I want to give distros a "heads up" for the new files.

We don't have a FILELIST at the moment because I can't find a canonical reference on it. The cited question concerned conventions for a Filelist; but it was closed and deleted by the community.

  • Do you care about files that were both added and removed between the tags? (e.g. if 1.1 added baz.h and then 1.2 removed baz.h, do you need to know about it?) – cjm Dec 4 '15 at 19:55
  • @cjm - I added additional information. Sorry about that. – user56041 Dec 4 '15 at 20:21
  • Even if there are no tags between the two you're interested in, if you have multiple commits there could still be files that were added and then removed between the two tags. – cjm Dec 4 '15 at 20:43
  • @cjm - I'm not interested in the transient stuff. Just the stuff that's been officially released and tagged. (If I am parsing your comments correctly). Also see Release Versioning | File Changes. – user56041 Dec 4 '15 at 20:54
4

git diff-tree -r --summary 1.0 2.0 should do this.

You could also just diff the tree listings:

diff <(git ls-tree -r --name-only 1.0) <(git ls-tree -r --name-only 2.0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy