'Fatal: cherry-pick failed' with Git
Solution 1
Since you have already edited the conflict file, you just need
git add mod/assign/locallib.php
then
git cherry-pick --continue
Solution 2
You attempted to do a merge (via either git merge
or git pull
) and have files that have conflicts that are not resolved. If you do git status
, you will likely see file(s) listed as being 'changed by both'. You need to take care of this before you do anything else.
Do git mergetool
and it will bring up the files one at a time. Fix the file so that the conflicts are resolved and then you should be able to proceed.
Related videos on Youtube
xan
Updated on May 09, 2020Comments
-
xan almost 4 years
I was working on a branch
X
. I made a commit and pushed it.Then I wanted to
cherry-pick
it to branchY
. But due to some unmerged files present, I got the following message:error: 'cherry-pick' is not possible because you have unmerged files. hint: Fix them up in the work tree, hint: and then use 'git add/rm <file>' as hint: appropriate to mark resolution and make a commit, hint: or use 'git commit -a'. fatal: cherry-pick failed
Now, I just want to delete my branch
Y
, then re-create the branchY
and then want to manually edit the file where I was trying to cherry-pick.Currently, I'm unable to delete the branch as it is my working branch. I cannot
checkout
any other branch. I'm getting the following error on trying to change the branch.mod/assign/locallib.php: needs merge error: you need to resolve your current index first
I just need to delete the branch
Y
, without losing anything on branchX
.EDIT #1
I edited the file
mod/assign/locallib.php
On doing
git status
, I get:# On branch MDL-38267_24 # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # both modified: mod/assign/locallib.php #
What file should I add in
git add ..
? -
xan almost 11 yearsPlease see my edits I made to the question. I mean the file which I modified and the file which is returned by
git status
are the same. How should I resolve the issue I'm having? -
Schleis almost 11 yearsYou need to resolve the conflict or
git reset
the file to an un-conflicted state. Depending on what you did that caused the conflict.