Git alias:
search-commits = !"f() { \
query=\"$1\"; \
shift; \
git log -S\"$query\" \"$@\"; \
}; f \"$@\""
Example:
git search-commitsExample: search for any commit that adds or removes string "foobar":
git search-commits foobarExample: search commits for string "foobar" in directory "src/lib":
git search-commits foobar src/libExample: search commits for "foobar", print full diff of commit with 1 line context:
git search-commits foobar --pickaxe-all -U1 src/libPosted by Mikko Rantalainen on StackOverflow.