I’m learning Git coming from Perforce.
As far as I can tell you must write the commit message in the same step as when you commit. Or am I missing how I might write the message earlier and have it hang around until I’m ready to commit.
I really liked the workflow in perforce where you can edit the changelist description at any time, and then checkin when you’re ready. Personally, I like to open the description many times and document as I code, or as I think of noteworthy things to point out.
Possible with Git?
Have a look at the
-t <file>flag withgit commitThis 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
rebasecommand andsquashthese 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.