10

I am trying to get authors of changes between 2 commits.

What would be the best for me is something like:

git diff --name-only master

but instead of

--name-only 

parameter like

--authors-only

But unfortunately diff does not have such one. There is no restriction I have to use diff command, git log or others are also fine.

I need to it to blame people who caused tests to fail.

legoscia
  • 39,593
  • 22
  • 116
  • 167
Michał
  • 691
  • 1
  • 5
  • 22

3 Answers3

9

git log --pretty=format:"%an" prevTestCommit..lastTestCommit | sort | uniq

DAle
  • 8,990
  • 2
  • 26
  • 45
3

you can use something like

git log --pretty=format:"%an %aE" f398e997ea9ad81e586b1f751693cd336963ba6a ^bb69eb11d979437a0b390ac9333342e7594c211c

where the format will print the author name and email and than the commits see List commits between 2 commit hashes in git

for more information on how to use get the commits between two given commits.

Community
  • 1
  • 1
Srgrn
  • 1,770
  • 16
  • 30
  • For some reason signs " ^" betweend hashes does not work for me, I needed to put ".." like stated in @DAle answer. – Michał Apr 13 '17 at 07:37
0

Not sure if this exists per default, but you could specify a custom output format for git log:

git log --pretty="format:%an"

This would print only author names. For more details, see the section PRETTY FORMATS in git log --help

Alderath
  • 3,761
  • 1
  • 25
  • 43