Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 693 Bytes

index.md

File metadata and controls

39 lines (27 loc) · 693 Bytes

git search-commits

Search for a given string in all patches and print commit messages

Git alias:

search-commits = !"f() { \
    query=\"$1\"; \
    shift; \
    git log -S\"$query\" \"$@\"; \
}; f \"$@\""

Example:

git search-commits

Example: search for any commit that adds or removes string "foobar":

git search-commits foobar

Example: search commits for string "foobar" in directory "src/lib":

git search-commits foobar src/lib

Example: search commits for "foobar", print full diff of commit with 1 line context:

git search-commits foobar --pickaxe-all -U1 src/lib

Posted by Mikko Rantalainen on StackOverflow.