Let's say you're editing a file in VIM, and want to see a diff between your current unsaved version and what's on the hard disk. Turns out you can just type this:
:w !git diff --no-index % -
What this does it pipes the whole contents of the current file to the command
git diff --no-index % -
The % symbol is substituted by vim to be the path to the saved file.
The - tells
git diff to read from STDIN.