LinuxCommandLibrary

git-fame

Show contribution statistics per file

TLDR

Calculate contributions for the current Git repository

$ git fame
copy

Exclude files/directories that match the specified regular expression
$ git fame --excl "[regular_expression]"
copy

Calculate contributions made after the specified date
$ git fame --since "[3 weeks ago|2021-05-13]"
copy

Display contributions in the specified format
$ git fame --format [pipe|yaml|json|csv|tsv]
copy

Display contributions per file extension
$ git fame --bytype
copy

Ignore whitespace changes
$ git fame --ignore-whitespace
copy

Detect inter-file line moves and copies
$ git fame -C
copy

Detect intra-file line moves and copies
$ git fame -M
copy

SYNOPSIS

git fame [] []

PARAMETERS

--by-file
    Show statistics per file rather than aggregate.

--sort lines | commits | author
    Sort the output by lines of code, number of commits, or alphabetically by author name (default: lines).

--no-pager
    Disable use of the pager (e.g., 'less').

--ignore-rev
    Ignore given revisions. Accepts multiple revisions (e.g., '--ignore-rev --ignore-rev ').

--since
    Show commits more recent than a specific date.

--until
    Show commits older than a specific date.

--exclude
    Exclude files matching the specified pattern.

--include
    Include only files matching the specified pattern.


    Operate on a specific file. If ommited all files in the repository are processed

DESCRIPTION

git-fame is a command-line tool that uses Git history to attribute lines of code in a file to their respective authors. It effectively combines the functionality of git blame and statistical analysis to provide a clear picture of contributions to a codebase. It identifies who wrote each line and presents aggregated summaries per author per file.
Unlike a simple blame command, git-fame focuses on summarizing contributions, making it easier to understand code ownership and identify key contributors. It goes beyond showing the most recent author of a line and tries to surface who originally authored a substantial portion of that file. This tool is useful for understanding the evolution of a project, identifying experts for specific files, and tracking contributions over time.
The output is presented in an easily readable format, displaying each author's contribution count, lines of code, and percentage contribution. It is very useful to understand a code base that you are not familiar with.

CAVEATS

git-fame requires a complete Git history to produce accurate results. Large repositories with long histories can take a significant amount of time to process. The tool can be inaccurate in cases of massive refactoring where authorship information is not properly preserved. The default pager behaviour can also be customized system-wide.

EXAMPLE USAGE

To view the contributions to a specific file: git fame path/to/file.txt.
To view contributions across the entire project, simply run git fame.
To sort the output by the number of commits: git fame --sort commits

SEE ALSO

git blame(1), git log(1)

Copied to clipboard