For all those little papers scattered across your desk
These tips make it easier to write better commit messages.
-m
(configure a proper editor)-v
git commit -m
Using -m
encourages short commit messages that don’t give meaningful
information. Did you know that omitting -m
gives you a chance to write your
commit in your favorite editor? I think many people assume that -m
is the only
way to avoid being dropped in to Vi (oh, the horror… I guess…), but you can make Git use any editor you
want.
Now you have room to write those standard formatted commit
messages.
The -m
flag is convenient for wip
-style save-my-progress commits that you’ll
rebase and reword. You will reword them, won’t you?
-v
to see your changes in the commit message templateYou’re writing your commit message and you want to review the changes to make sure you commented on everything. What do you do?
:DiffGitCached
with
\v
,
personally. Or :Git --paginate diff --cached
.git diff --cached
.--verbose
.See that last one? If you need to, turn on commit.verbose
; then Git will
include the diff in your commit message template for you to refer to.