Besides it's trivial to change the commit in an editor if you're not happy with it with a simple "git commit --amend". It's even possible to change your mind in the middle of the commit command by adding '-e' as somebody else helpfully pointed out in this comment section.
I mean, I don't think my way is superior to yours, but I don't think it's inferior either. It's just a matter of taste and workflow I suppose. In particular I don't really see why editing text in vim is going to make you more or less likely to realize that you forgot to "tweak something or stage a change". And at any rate as long as you haven't pushed anything it's trivial to rewrite the commit.
[is writing commit message]
Oh wait… What did I change?
^Z
git diff --cached
Oh yeah. fgBut it's still more efficient method for single repository project where using UI git client would be the overkill.
I have no idea why anyone would ever not use this to be honest.
:r !git status -v
Type my commit message above the output, and then visually highlight the lines of my commit message and then run :'<,'> !git commit -F -
In fact, if I see an issue with the diff, I can update the relevant file and then run: :!git add %
and then go back to the window with the status output, delete it and rerun the status -v command.In fact, if I want to be more fine grained with the changes I stage in git, I can run:
:r !git diff
to get the output of the unstaged changes, copy the hunk header lines, paste them above the hunk I want to stage, visually highlight the hunk with the header lines, and then run: :'<,'> !git apply --cached -
to stage that hunk. I've even done things like using recountdiff to update the hunk header if I decide to removed added lines or restore deleted lines in a hunk. Personally, I think it's easier than using git add -p or reset -p.You can just add -e to the end to either finish writing or checking it in Vim then, which is what I almost always do when I use -m.
-v makes this so much better - forget seeing the list of files in the commit; you can see the whole diff! :)
Any good commit message should have at least a paragraph explaining the rationale, functional change and maybe links to design docs or bugs. All the time I come across commit descriptions from decades ago, that are useful because of this.
Not to say that verbose commit messages are a bad thing, it's always better to have too many details than not enough, but I think very long commit messages might also sometimes hint that either the commit is "too big" and should've been broken down in smaller, atomic changes or, as I said above, that you're really just writing documentation and that may be better suited for an other place.
Commits should definitely be descriptive and accurate, but if you break your changes in small chunks you can generally still do that in one or two sentences in my experience.
A lot of people do. If you've ever used git blame on a file, you can see which commit each line in the file is associated with. You can then run git show <sha1> for that commit and see the message and associated diff. Having that information can help you understand why a change was made and may help you avoid introducing regression type errors.
If long-term-ism in commit messages isn't something you care about (which is understandable), then consider short-term benefits. When working with my team, I'm able to read some of their recent commits and understand very clearly what's being worked on, without needing to dive into the code or have daily stand-ups which aren't producing any value on their own.
Think of it as an asynchronous way of describing what you're working on, and the broader context.
At work we squash PRs and that's where we can write more details if necessary, or just hope the associated PR with details will be available in the future.
For my personal projects, I don't care that much. When I realize a mistake, there's always amend.
If you want to use a different editor just for git you can set $GIT_EDITOR in your environment.
Edit: In fact, still don't. The git editor seems to be configured by some git config rather than environment variables.