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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…