Assaf Lavie Assaf Lavie - 2 months ago 15
Git Question

git: Show index diff in commit message as comment

When

git commit
open the message editor is shows a brief status, something like this:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is ahead of 'origin/master' by 26 commits.
#
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: Showcase/src/com/gigantt/BorderArea.mxml
# modified: Showcase/src/com/gigantt/Client.mxml
# modified: Showcase/src/com/gigantt/GraphItem.mxml
#


How can I tweak git to show also the diff to be committed?
I'm aware that it may be a long diff, but still.. so useful.

Answer

The --verbose (or -v) flag for git commit will display the diff of what would be committed:

git commit --verbose