0

When I hit c c in the Magit buffer it opens the commit message buffer. Then I write my message and type C-c C-c to close it. For some reason it saves .git/COMMIT_EDITMSG and every next time when I hit c in the Magit buffer it opens .git/COMMIT_EDITMSG instead of commit popup.

Does it have anything to do with Magit itself or is this somewhere in my git setup?

2

For some reason it saves .git/COMMIT_EDITMSG

That's what is supposed to happen. Magit calls git commit, which uses the editor specified by $EDITOR (which Magit arranged to be an emacsclient instance which connects to the current Emacs instance), the user writes the message and finishes with C-c C-c. That causes emacsclient to exit with zero exit status (success) and git commit then takes the text it finds in .git/COMMIT_EDITMSG and uses it as the commit message.

every next time when I hit c in the Magit buffer it opens .git/COMMIT_EDITMSG instead of commit popup.

That most likely means that you did not finish writing the message by pressing C-c C-c. Instead you somehow moved away from the buffer. If a commit is in progress, then c does not show the commit popup. Instead it puts you in the existing buffer so that you can finish writing the message and then press C-c C-c (or C-c C-k to abort).

  • 1
    On odd occasions in the past I've ended up in similar situations where Magit seemed quite insistent about me finishing an older commit message, and C-c C-k did not convince it to drop the matter. On those occasions I ended up using C-c C-c and then fixing it afterwards. Is there any other command which would tell Magit to forget all about a commit-in-progress? (I feel that's basically what C-c C-k is expected to do, but it would be useful to know if there's a bigger hammer to hit it with if this ever occurs again.) – phils Jan 7 at 23:17
  • Thank you for the explanation. If I make a commit (finish it with C-c C-c), while it is still not pushed to the remote branch and I then type c it again brings me to the last commit message, even though it is not "unfinished" (the commit is created and incorporated in the local tree). If now, in the last commit's message buffer, I type C-c C-k it closes is and any subsequent cs from the Magit buffer bring up the commit dialog. Is this also expected? – foki Jan 8 at 1:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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