Git: find a string in your uncomitted files

Today I was working on a big refactor and I needed to find something I was sure of I changed. However I had a ton of unstaged files and didn't really want to go search for the needle in the haystack so I searched for an easier solution.

The solution I found, this simple command:

git diff --name-only | xargs grep 'your query'

This command will also be handy when for example searching for TODO's you left in your code.

Source: Stackoverflow