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?
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.
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.
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.
You can also quit the git blame window using the q key on your keyboard.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With