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).