문제

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