LinuxCommandLibrary

git-whatchanged

Show changes for each commit

TLDR

Display logs and changes for recent commits

$ git whatchanged
copy

Display logs and changes for recent commits within the specified time frame
$ git whatchanged --since "[2 hours ago]"
copy

Display logs and changes for recent commits for specific files or directories
$ git whatchanged [path/to/file_or_directory]
copy

SYNOPSIS

git whatchanged [] [] [--] [...]

PARAMETERS

--all
    Show all commits in all branches.


    A range of commits to display (e.g., HEAD..master, v1.0..v2.0).

-p, --patch
    Show the full diff patch for each commit.

--since=, --after=
    Show commits more recent than a specific date.

--until=, --before=
    Show commits older than a specific date.

--author=
    Limit commits to those authored by someone matching the pattern.

--committer=
    Limit commits to those committed by someone matching the pattern.

...
    Limit commits to those that affect the specified paths.

--left-right
    Mark which side of a symmetric difference each commit is reachable from.

--reverse
    Output the commits in reverse order.

--format=
    Pretty-print the commit contents in a specific format.

--grep=
    Limit commits to those with log messages matching the specified pattern.

--date=
    Only takes effect for dates displayed in human-readable format, such as when using --pretty.

DESCRIPTION

The git-whatchanged command provides an enhanced view of the commit history within a Git repository, displaying the commit log messages alongside a diffstat summary. Unlike simpler log commands, it highlights the changes introduced by each commit by providing file modification statistics. This includes the number of inserted and deleted lines for each file affected by the commit. This makes it easier to understand the scope and impact of each commit at a glance.

It's commonly used to review a project's development history, identify where specific changes were made, and assess the evolution of different files over time. It can be restricted by date, branch, author or file and it can output in different formats.

DIFFSTAT OUTPUT

The diffstat output shows a summary of the changes introduced by each commit, including the number of added and deleted lines for each affected file. This helps quickly assess the magnitude and scope of the changes in each commit.

HISTORY

git whatchanged is part of the core Git suite. It has been present since the early days of Git's development, offering a way to inspect commit history with a focus on visualizing the impact of individual commits through its diffstat output. It builds upon basic log functionalities to provide a more detailed overview of code changes.

The command remains actively maintained as a valuable tool for developers to understand and analyze project history, it's still maintained and improved, incorporating new features and bug fixes as the Git project evolves.

SEE ALSO

Copied to clipboard