Deepak Deepak - 3 months ago 31
Git Question

Git diff between two tags with username

I can do following:

git diff tag1 tag2 --stat


But this gives me list of files.. How can I know all users who have worked between these two tags !

Answer

A first approach could use git log:

In the git repo itself:

 git log v2.9.0..v2.9.3 --name-only --format="%aN <%aE>" --reverse
 git log <olderTag>..<newerTag> --name-only --format="%aN <%aE>" --reverse
                   ^^
                    |_ don't forget the two dots.

(On the git dots syntax, see "What are the differences between double-dot “..” and triple-dot “…” in Git commit ranges?")

That gives:

Eric Wong <e@80x24.org>

daemon.c
Edward Thomson <xx@xx>

pretty.c
t/t6006-rev-list-format.sh
David Kastrup <xx@gxx>

builtin/blame.c
René Scharfe <xx@xx>

t/t4051-diff-function-context.sh
t/t4051/appended1.c
t/t4051/appended2.c
t/t4051/dummy.c
t/t4051/hello.c
t/t4051/includes.c

....

And to get just the list of unique contributors:

git log v2.9.0..v2.9.3 --format="%aN <%aE>" --reverse|sort|uniq

That returns:

Alex Henrie <xx@xx.com>
Alfred Perlstein <xx@xx.org>
Andreas Brauchli <a.xx@xx.net>
Andrew Oakley <xx@xx.com>
Armin Kunaschik <xx@xx.com>
Charles Bailey <xx@xx.net>
Charles Bailey <xx@xx.org>
Chris Packham <xx@xx.com>
Dave Nicolson <xx@xx.com>
...