Looking for Things and using the History on Git: Examples and Reference

Last updated:
Table of Contents

WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.

List commits that changed a file

The last argument is the path to a file or a glob pattern (file paths with wildcards).

Example: list all commits that changed files whose name includes "some-file", in any directory.

$ git log --all --full-history -- *some-file*

List commits with commit message matching text

Example: list all commits whose commit message contains text "some text"

$ git log --grep="some text"

git log options

log is the main git subcommand to display commit history and other historical information.

git log -p

-p modifier: include diffs in the output of log

See also

Dialogue & Discussion