How to find all users who wrote code in particular file in Git?

382 views Asked by At

How to get the list of all users who contributed for this one file ?

1

There are 1 answers

1
Useless On BEST ANSWER

You can find most of this by reading the online help for git log (and the deduplication step is basic shell knowledge, assuming you have something like a reasonable shell).

  1. get the list of all commits affecting the file:

    git log -- filename

  2. format the commits so only the author is printed:

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

  3. make sure effective no-op commits are not pruned, if that matters:

    git log --pretty=format:%an --full-history -- filename

  4. deduplicate

    git log --pretty=format:%an --full-history -- filename | sort -u