# [BUG] "git commit" after "cherry-pick -n" conflict clobbers .git/COMMIT_EDITMSG

2 messages from 2012-10-11 to 2012-10-11. Participants: Yann Dirson, Junio C Hamano.
Thread: https://gitlist.dev/t/31785

## Yann Dirson, 2012-10-11 09:33

Subject: [BUG] "git commit" after "cherry-pick -n" conflict clobbers .git/COMMIT_EDITMSG
Message-ID: <20121011113352.006efa25@chalon.bertin.fr>
URL: https://gitlist.dev/e/20121011113352.006efa25%40chalon.bertin.fr

```
(only tested with 1.7.10.x for now)

~/softs/linux$ echo foo > .git/COMMIT_EDITMSG
~/softs/linux$ git cherry-pick -n b55f3d92cd
error: could not apply b55f3d9... Linux 2.6.32.26
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
~/softs/linux$ cat .git/COMMIT_EDITMSG
foo

So far, so good.  But then "git commit" brings me the message from the
cherry-picked commit plus the list of conflicted files, and I can verify that
it is now the contents of .git/COMMIT_EDITMSG.

Surely the fact I passed "-n" should prevent cloberring the message, even in the
event of a conflict.  I suppose that would imply not creating .git/MERGE_MSG in that
case, but just removing it still causes .git/COMMIT_EDITMSG to be clobbered, this
time with nothing but the "git status"-derived comments.

-- 
Yann Dirson - Bertin Technologies

```

## Junio C Hamano, 2012-10-11 17:00

Subject: Re: [BUG] "git commit" after "cherry-pick -n" conflict clobbers .git/COMMIT_EDITMSG
Message-ID: <7vzk3t6j0a.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vzk3t6j0a.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20121011113352.006efa25@chalon.bertin.fr>

```
Yann Dirson <dirson@bertin.fr> writes:

> (only tested with 1.7.10.x for now)
>
> ~/softs/linux$ echo foo > .git/COMMIT_EDITMSG

Why are you mucking with such an internal implementation detail in
the first place?

> ~/softs/linux$ git cherry-pick -n b55f3d92cd
> error: could not apply b55f3d9... Linux 2.6.32.26
> hint: after resolving the conflicts, mark the corrected paths
> hint: with 'git add <paths>' or 'git rm <paths>'
> ~/softs/linux$ cat .git/COMMIT_EDITMSG
> foo
>
> So far, so good.  But then "git commit" brings me the message from the
> cherry-picked commit plus the list of conflicted files, and I can verify that
> it is now the contents of .git/COMMIT_EDITMSG.

You verified that "what" is now in .git/COMMIT_EDITMSG?  The commit
log message for you to edit to record the result of the cherry-pick?

If that is the case, what is the problem?

If anything you had in .git/COMMIT_EDITMSG before you started
"'cherry-pick -n', edit further to adjust, and then 'commit'"
sequence were to appear in the editor to edit the commit log,
it would be a bug, I would think.

```
