开发者

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.


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.


As I mention in the comments, "How do I find common files changed between git branches?" is the main solution here:

git log [--pretty=<format>] --name-only tag1..tag2

or

git diff --name-only tag1 tag2

(Also mentioned in Gitology recipe)

BUT: as mentioned in "How to get a list of directories deleted in my git repository?", Git only tracks content of files, not directories themselves.

To include informations about directories, you need to start playing with git diff-tree.

any directory that has been created or removed will have 040000 in the second or first column and 000000 in the first or second column respectively. This are the tree entry 'modes' for the left and right entries.

Something like (according to Charles Bailey):

git diff-tree -t origin/master master | grep 040000 | grep -v -E '^:040000 040000'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜