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
views:
44answers:
2As 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 and000000
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'
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.