Search code examples
androidgitdiffchangelog

Create a listing of changed files/directories/etc. using git between two tags


I need to generate a changelog of sorts between two Tags within a project controlled using git, specifically the android source code. This list should include any files/directories/etc which have been edited, moved, renamed, deleted, created.

Any help would be great. And if you have a way to do this over the entire android source at once... even better.


Solution

  • If you need to find which files differ:

    git diff --name-only <tag1> <tag2>
    

    If you need to find all changed files:

    git log --name-only --pretty=format: <tag1>..<tag2> |
        grep -v '^$' | sort | uniq
    

    The --pretty=format: is to supress printing information about commits, and print only the diff part. Note that in the case of git log the order of <tag1> and <tag2> matters.