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

Time:10-22

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

CodePudding user response:

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

  • Related