Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 774
dan Avatar asked Mar 30 '10 20:03

dan


People also ask

How do I display only the names of changes to a file?

git show --name-only SHA1 . you can also do: git diff --name-only HEAD@{3} HEAD@{0} for the exact commits you want to compare.

How does git diff work internally?

The super-short version is that git status runs git diff . In fact, it runs it twice, or more precisely, it runs two different internal variations on git diff : one to compare HEAD to the index/staging-area, and one to compare the staging-area to the work-tree.


1 Answers

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.

like image 189
Jakub Narębski Avatar answered Sep 30 '22 11:09

Jakub Narębski