Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 968
DerKlops Avatar asked Apr 27 '10 12:04

DerKlops


People also ask

How to use git blame in a file?

The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was. The output format of git blame can be altered with various command line options.

How to git blame specific line?

Blaming only a limited line range Sometimes, You don't need to blame the entire file, you just need to blame in a limited line range. Git blame provides the option for that. -L will take the option for the start line and for the end line.

What is git Shortlog?

The git shortlog command is a special version of git log intended for creating release announcements. It groups each commit by author and displays the first line of each commit message. This is an easy way to see who's been working on what.

How to exit git blame?

You can also quit the git blame window using the q key on your keyboard.


1 Answers

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
like image 174
knittl Avatar answered Oct 31 '22 15:10

knittl