Skip to content

exploring Git history

listing commits applied to a relevant file

Note

  • foobar.baz represents the relevant file.

Use git log -- foobar.baz.

explanation

Note

This is an incomplete explanation.

  • The -- option causes only commits that are enough to explain how the files that match the path(s) following it came to be to be shown.

listing commits in which relevant text was added to a patch or removed from a patch

Note

Use git log --all --reverse --source -i -p -G "foobar".

explanation

Note

This is an incomplete explanation.

  • The -G option searches for patch text differences containing added or removed lines matching a string or a regular expression.
  • The -i option enables case insensitivity for the -G search.
  • The -p option generates a patch.
  • The --reverse option outputs commits in reverse order.

listing commits in which relevant text was present in a log message

Note

foobar represents the relevant text. Regular expressions are supported.

Use git log -i --grep="foobar".

explanation

Note

This is an incomplete explanation.

  • The -i option enables case insensitivity for the --grep search.
  • The --grep option searches for log messages matching a string or a regular expression.

prior work

licensing

No rights reserved: CC0 1.0.