質問

How do I search through all git commits with a grep and then format the results with just the commit hash and the commit notes.

I have tried something like this.

git log --pretty=format:%H %N --grep=mysearchtext

Not sure if I am missing some command pipes somewhere.

役に立ちましたか?

解決

Assuming you're talking about the commit message and not the notes, you don't want to use %N. Perhaps %s would be better, or %s %b. That's up to you. Also, make sure you single or double quote the --pretty flag so it's not split into two arguments

git log "--pretty=format:%H %s" --grep=mysearchtext
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top