views:

44

answers:

2

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. Thanks

A: 

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'
VonC
thank you for the reply and link to further information I will look over them and see if they work for my unique situation.
dan
+1  A: 

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.

Jakub Narębski
That definitely helped and I think it solves my problem for the most part. A couple of follow of questions. 1) is there a way to limit this to show only one type of element (i.e. only directories) or at the very least label the element type. 2) you mention that the tag order matters, can you point me to a doc which explains how the ordering makes a difference so I can determine my correct order. ( I will continue to research this all on my own as well and post back if I find what I am looking for independently)
dan
edit the above example to read (i.e. only symlinks) as having read the below comment I see I will need a different command to find changed directories
dan
@dan: Re 2.) in the case of "`git log <tag1>..<tag2>`" it shows history from later tag2 to tag1, i.e. tag1 should be earlier than tag2. Well, you can always use symmetric `<tag1>...<tag2>` which shows changes from common ancestor...
Jakub Narębski
@Jakub Thank you, I was just able to experiment with that myself and get a feel for the difference. Especially if a file has been added/deleted the ordering will change which classification it is.
dan
@Jakub: good precisions on the log format part. +1
VonC