I wanted to search for the commit that either contains the string "hello world" or any commit that included that phrase inside of a file.
git log -SHello World
doesn't work
git log -S'Hello World'
doesn't work
git log -S"hello world"
doesn't work
I have been using: git log -i --grep='hello world'
but this one only works for commit messages.
Git Log OnelineThe oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.
"SHA" stands for Simple Hashing Algorithm. The checksum is the result of combining all the changes in the commit and feeding them to an algorithm that generates these 40-character strings. A checksum uniquely identifies a commit.
You can press q to exit. git hist is using a pager tool so you can scroll up and down the results before returning to the console.
Check Commit History: This will show you all the commit messages, authors name, and email, as well as the date and time they were committed. There one thing that frustrates many beginners about using git log or git diff they can't figure out a way to exit commit log. To exit git log, type “q” or “z”.
The pickaxe search (git log -S
) looks for the addition or removal of a word in a commit (and not in a commit message).
See the comment on this answer.
If you have a commit message which includes that word, but the commit content itself does not have "hello world
" as being added or removed (meaning, for instance, it is already there, from previous commits), that commit would not be reported.
Other than that, git log -S 'This repos'
or git log -S'This repos'
should work just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With