COMMIT_EDITMSG from previous commit is used for a new commit

281 views
Skip to first unread message

Cody Addison

unread,
Nov 23, 2015, 4:37:42 PM11/23/15
to magit
I am using emacs 24.4 with a server/client setup. On the first commit, everything works fine. I get a COMMIT_EDITMSG buffer, edit it, and use C-c C-c to make the commit. The next time I use 'c' from the magit status buffer the same COMMIT_EDITMSG buffer with the message for the previous commit pops up. I then have to C-c C-k to stop the commit. Then when I press 'c', the commit popup opens. I found a few posts around about using emacsclient and not having COMMIT_EDITMSG close properly, but I couldn't determine that they are in fact my issue and how to work around the problem. Thanks in advance for the help.

Jonas Bernoulli

unread,
Nov 28, 2015, 11:44:51 AM11/28/15
to Cody Addison, magit
Sometimes Git gets confused when you abort a "sequence action" like a
cherry-pick in non-standard way. That causes a file to remain in .git
whose content then ends up being used when creating a new commit. When
that happens, then the buffer used to edit the message should contain a
message like "Are you doing XY? If not then delete FILE."

If that's not the case, then COMMIT_EDITMSG probably got left behind for
some reason. Deleting that file should also fix the issue.

Cody Addison

unread,
Nov 30, 2015, 4:49:21 PM11/30/15
to magit, cody.a...@gmail.com
On Saturday, November 28, 2015 at 10:44:51 AM UTC-6, Jonas Bernoulli wrote:
> If that's not the case, then COMMIT_EDITMSG probably got left behind for
> some reason. Deleting that file should also fix the issue.

Deleting COMMIT_EDITMSG does fix the problem, but only for the next commit. Once that commit happens, COMMIT_EDITMSG is left around again. I suspect that the COMMIT_EDITMSG buffer and/or file should be killed/deleted once the commit happens. For some reason this isn't happening for me.

Jonas Bernoulli

unread,
Dec 3, 2015, 9:31:42 AM12/3/15
to Cody Addison, magit
Git is informed about you being done editing by `emacsclient' exiting.
When the exit code is zero, then that means that the commit should be
created. Git then takes the message from the file (which was previously
saved by Magit/Emacs), creates the commit using that message, and then
deletes the file.

I cannot think of a reason why Git would forgo deleting the file, not
when it succeeds in creating the commit. Check the file permissions and
that you are using a recent Git version.
Reply all
Reply to author
Forward
0 new messages