DerKlops
DerKlops

Reputation: 1249

How can i get just the authors of a specific file from a git-repo?

I have a git-repo and need only the authors of a specific file. I can extract the authors from the git-blame command, but is there an easier way to get only the author names of a file?

Upvotes: 5

Views: 337

Answers (2)

chaqke
chaqke

Reputation: 1617

This is usually what I want:

git log --format="%ad %an" -- $file

(includes the date of the commit)

Upvotes: 0

knittl
knittl

Reputation: 265956

git log --format=%an -- $file

will show you all commits for that file and only the authors for that commit. so you have one author per line

another easy solution would be to use git shortlog

git shortlog -s -- $file # add -n to sort by number of commits

Upvotes: 8

Related Questions