I tend to write the commit message as I go along and stage changes.

At the moment I use a scratch buffer for this, but it would be nicer if I could edit it in Magit from the start. Is this possible and if so how?

EDIT: I should say that I am a little unusual when it comes to commit messages: I write the problem that the commit solves rather than what has changed.

e.g. "get_prop("1") raises exception" rather than "cast strings to integers in get_prop"

Personally I think this is much more sensible than saying what you've done (which is evident in the the commit already).

Consequently I have to write the commit message first.

  • My workflow for this is to commit any newsworthy change, then for the next one to use either ce (to just extend my change), ca (to ammend and edit the message) or cw (to change the wording of the commit).
    – wasamasa
    Dec 17, 2016 at 18:28
  • Thanks wasamasa. You solution would work except for an eccentricity of my workflow - see edit.
    – cammil
    Dec 17, 2016 at 18:35
  • You could still follow wasamasa's suggestion: just replace the first step with "commit an empty change". PS I agree describing the problem in the commit message makes sense, but I like to write the code to solve it first, otherwise I can't really be sure I've understood the problem.
    – npostavs
    Dec 17, 2016 at 19:09

1 Answer 1


As explained in the comments, you can start by creating an empty commit (a commit that doesn't actually change any files) to write the message first. Then you can stage as usual, and finally you can amend the staged changes to the HEAD commit using c e.

If you need to make some tweaks to the message you can then use c w, or you can combine these two steps using c a .

To create an empty commit use c - e c, but since you are doing this regularly, you should enable the --allow-empty switch permanently, which you can do using c - e C-x C-s once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.