Is it possible to get the hash of a commit from a commit message?
I ran the following git log | grep tap
and got a list of commit messages only, no hashes.
I need to cherry-pick a few of the listed commits, but don't want to manually search for them all to find the commit hashes.
Yep you can.
You have minor mistake in your command:
The correct command is to use the --grep
as flag to the log and not as a unix command after the pipe |
git log --grep=".. any text you need to find ..."
git log --grep=<pattern>
Limit the commits output to ones with log message that matches the specified pattern (regular expression).
With more than one
--grep=<pattern>
, commits whose message matches any of the given patterns are chosen (but see--all-match
).When
--show-notes
is in effect, the message from the notes is matched as if it were part of the log message.
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