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
- foobar represents the relevant text. Regular expressions are supported.
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
- The functionality of the
-G
option was introduced to me by an answer on Stack Overflow by Jakub Narębski. - The functionality of the
-p
option was introduced to me by an answer on Stack Overflow by Nathan Kinsinger. - The method of listing commits applied to a relevant file was introduced to me by an answer on Stack Overflow by ralphtheninja.
- The method of listing commits in which relevant text was added to a patch or removed from a patch was introduced to me by an answer on Stack Overflow by Mark Longair and an answer on Stack Overflow by Ciro Santilli.
- The method of listing commits in which relevant text was present in a log message was introduced to me by an answer on Stack Overflow by hobbs.
licensing
No rights reserved: CC0 1.0.