search for text appearance in a file's git history
Git grep way
Eg. Search for "use-query-params" in package.json's git history
git grep use-query-params $(git rev-list --all -- package.json) -- package.json
As a function in .bashrc/.zshrc-file
# search for word in a file's git history
# usage: filehistorysearch "use-query-params" package.json
filehistorysearch() {
git grep $1 $(git rev-list --all -- $2) -- $2
}
Alternatively, git log way
git log -S <pattern>
https://will-keleher.com/posts/small-programming-tricks-matter/