LinuxCommandLibrary

git-guilt

Show change contribution per author

TLDR

Show total blame count

$ git guilt
copy

Calculate the change in blame between two revisions
$ git guilt [first_revision] [last_revision]
copy

Show author emails instead of names
$ git guilt [[-e|--email]]
copy

Ignore whitespace only changes when attributing blame
$ git guilt [[-w|--ignore-whitespace]]
copy

Find blame delta over the last three weeks
$ git guilt 'git log --until "3 weeks ago" --format "%H" [[-n|--max-count]] 1'
copy

Find blame delta over the last three weeks (git 1.8.5+)
$ git guilt @{3.weeks.ago}
copy

SYNOPSIS

git guilt [options] [commit1] [commit2] [--] [path...]

PARAMETERS

commit1
    Optional. The older commit hash or reference. If omitted, defaults to the parent of commit2 (or HEAD~1 if only one commit is provided).

commit2
    Optional. The newer commit hash or reference. If omitted, defaults to HEAD.

path...
    Optional. Limit the analysis to specified files or directories.

-s, --since
    Show commits more recent than a specific date. Date formats can be absolute (e.g., "2023-01-01"), relative (e.g., "2 weeks ago"), or a timestamp.

-e, --until
    Show commits older than a specific date. Useful for defining the end of a time window.

--no-merges
    Do not follow merged commits. This excludes changes introduced directly by merge commits.

--porcelain
    Produce machine-readable output. The output format becomes more structured, typically one author per line with counts.

--all
    Show all changes, including renames and copies. By default, git-guilt might simplify certain diffs; this ensures a comprehensive view.

--no-renames
    Disable rename detection. Treats renamed files as deletions and additions rather than just renames.

--full-index
    Show full index info for diff. Includes full object names on the command line output, useful for debugging or detailed analysis.

DESCRIPTION

git-guilt is a utility from the git-extras collection designed to analyze code churn by attributing changes between two specified points in Git history to individual authors. Unlike git blame which shows who last modified each line in the current version of a file, git-guilt identifies who caused the changes (additions, deletions, modifications) to lines that are different between an older commit and a newer one. It aggregates these changes by author, providing insights into who has been most active or responsible for the evolution of a codebase or specific files within a given range of commits. This command is particularly useful for understanding the impact of developers over a period, tracking feature development, or analyzing refactoring efforts. It helps to answer "who is responsible for the difference between this version and that version?"

CAVEATS

External Dependency: git-guilt is not a core Git command. It is part of git-extras, a collection of supplementary Git utilities. Users must install git-extras separately to use git-guilt.

Performance: Analyzing a large range of commits or an entire repository with extensive history can be computationally intensive and may take a significant amount of time.

Interpretation: While it attributes changes to authors, it's essential to understand that "guilt" in this context refers to authorship of changes, not necessarily negative responsibility. It's a measure of active contribution to code evolution.

<B><I>UNDERSTANDING "GUILT"</I></B>

The term "guilt" in git-guilt should be understood as "responsibility for changes" rather than a negative connotation. It quantifies an author's contribution to the delta between two commits, making it valuable for code ownership analysis, understanding developer activity, or pinpointing who introduced specific changes.

<B><I>TYPICAL USE CASES</I></B>

Feature Analysis: Determine which developers contributed most to a new feature branch.
Refactoring Impact: Identify who was most involved in a large refactoring effort.
Onboarding: Understand which parts of the codebase new team members are actively modifying.
Code Evolution: Analyze how contributions change over time in a specific module.

HISTORY

git-guilt is a relatively specialized command that gained popularity as part of the git-extras project, which began development around 2009-2010. git-extras aims to provide various convenient Git workflows and analyses that are not natively included in the core Git distribution. git-guilt fills a niche for analyzing authorship of code churn, a task not directly addressed by core commands like git blame or git log. Its ongoing development is tied to the git-extras project, which is maintained by its community.

SEE ALSO

git log(1): Shows commit logs. Can be used to view history before running git-guilt., git blame(1): Shows what revision and author last modified each line of a file. Unlike git-guilt, it operates on the current state of a file, not changes between two states., git diff(1): Shows changes between commits, commit and working tree, etc. git-guilt uses diffing internally., git shortlog(1): Summarizes git log output, grouping commits by author.

Copied to clipboard