for commit in $(git rev-list --all); do# search only lines starting with + or -if git show "$commit" | grep "^[+|-].*search-string"; thengit show --no-patch --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short $commitfidone
示例输出,底部的git提交是第一个引入我正在搜索的更改的:
csshx$ for commit in $(git rev-list --all); do> if git show "$commit" | grep "^[+|-].*As csshX is a command line tool"; then> git show --no-patch --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=short $commit> fi> done
+As csshX is a command line tool, no special installation is needed. It may987eb89 2009-03-04 Gavin Brock Added code from initial release