After reading 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
cat file
show you the current working copy offile
?cat file
would bring upbar
, which is not what I want.foo
, then a line break, thenbar
. i.imgur.com/uGwgq.png