See also: git commit -v
I usually just run git diff in another tmux window, which seemed simpler than this article, but your suggestion is better still.
Or just use magit in Emacs, which automatically shows you a diff in one buffer and you edit your commit message in another.
Yeah, magit is my favorite tool in a long time - the support for viewing staged diff chunks and operating on them individually - including discarding them if they’re just e.g. debug prints - is pretty great.
It’s also being improved regularly, for example I like the new command for starting a new branch and cleaning up the current branch (probably master) after you’ve already committed some things - magit-branch-spinoff, that’s not in the online docs yet: github.com/magit/magit/blob/master/Documentation/magit.org – search for spinoff
Thanks for sharing about magit-branch-spinoff. That looks useful! I haven’t been tracking what the new features in magit are, perhaps I should!
For Mercurial, I use this committemplate (hg help hgrc.committemplate):
hg help hgrc.committemplate
The most interesting part is the last line of the template which shows the diff. That way, I have a full diff in the same place where I’m writing the commit message. I need to get around to writing an Emacs hg commit mode that will properly syntax highlight the diff, but the lack of colour hasn’t annoyed me enough to do this yet.
Thanks Jordi! adds to hgrc
VIM users can use YUNOCommit. This plugin will remind you to commit after 20 writes.
I typically use git add -p which refreshes my mind of what code was updated and then can write out a quick git commit -m after that.
git add -p
git commit -m
I find -v much more convenient than tmux. I have the following aliases in my .bashrc is
alias gc='git commit -v'
alias gca='git commit -a -v'
alias gcaa='git commit -a --amend -v'
alias gcaaC='git commit -a --amend -C HEAD'