After reading [Git pre-commit hook : changed/added files](https://stackoverflow.com/questions/2412450/git-pre-commit-hook-changed-added-files), the following question arose:

Given I have a file with both staged and unstaged changes, how can I display a preview of the file's contents after staging?

**Example:**

```
echo "foo" >> file
git add file
echo "bar" >> file

```

Wanted output:

```
[previous contents of file]
foo

```