Verbose commiting

on December 12, 2016. in Software, Development. A 1 minute read.

One thing I recently learned about git, is the -v or --verbose flag for the git commit command. It shows the diff of what is being commited in $EDITOR below the commit message
template. Taken directly from man git commit:

Show unified diff between the HEAD commit and what would be committed at the bottom of the commit message template to help the user describe the commit by reminding what
changes the commit has. Note that this diff output doesn’t have its lines prefixed with #. This diff will not be a part of the commit message.

I keep double checking the code that I commit, so prior to discovering this flag, I was constantly switching between writing the commit message and seeing what’s in the diff. This now
gives me the diff inside vim, as that is my specified $EDITOR. I can navigate the diff using vim motions, use search, etc, which greatly improves my workflow.

Happy hackin’!

Tags: git, message, verbose, diff.