I have some modified files in my repo's working tree, and I want to search for some text in the changed lines of these files. I can only find how to search in the previous commits using git grep.
git grep
How can I achieve this?
You can do this by using git diff and then pipe it to grep:
git diff
grep
git diff --unified=0 | grep --ignore-case "text"
Setting --unified=0 makes sure that only the changed lines are returned, without their context.
--unified=0
1.4m articles
1.4m replys
5 comments
57.0k users