Write git commit message before 'git commit'
Have a look at the -t <file>
flag with git commit
This lets you specify a file to use as the basis for the commit message. The editor is still invoked but at least you can use a commit message which you create in advance.
Alternatively, there is another workflow that you can use with git that might better suit your way of working:
With git you can work on a separate branch from the main line and make lots of small commits with their own messages. Although each of these commits by themselves may not solve the problem that you are working on, they do provide a way of saving the intermediate states of your work with the same sort of messages that you may have been updating in your commit message file.
Once you are ready to commit the sum of your work, you can use the rebase
command and squash
these commits together. Your editor will then be invoked with the all the individual messages that you used for the smaller commits which you can then edit together into a single message.
This is a lot easier than it sounds here, and is IMHO a more git-like approach.
As long as you haven't push
your commit to others, you can do a git commit --amend
. This will allow you to modify your commit, as well as your commit message.
I found this really help with the 'commit early and often', without get overwhelm by the number of trivial commits.