'致命:樱桃挑选失败'与Git
问题描述:
我正在分支X
。我做了一个提交并推送它。然后我想cherry-pick
它分支Y
。但由于一些未合并的文件提出,我得到了以下信息:'致命:樱桃挑选失败'与Git
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
现在,我只是想删除我的分支Y
,然后重新创建分支Y
,然后需要手动编辑我在那里的文件试图挑选樱桃。
目前,我无法删除分支,因为它是我的工作分支。 我不能checkout
任何其他分支。我在尝试更改分支时遇到以下错误。
mod/assign/locallib.php: needs merge
error: you need to resolve your current index first
我只需要删除分支Y
,没有分支X
失去任何东西。
编辑#1
我编辑的文件mod/assign/locallib.php
做git status
,我得到:
# On branch MDL-38267_24
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: mod/assign/locallib.php
#
我应该git add ..
添加是什么文件?
答
既然你已经编辑冲突文件,你只需要
git add mod/assign/locallib.php
然后
git cherry-pick --continue
答
您试图执行合并(通过git merge
或git pull
)并且具有未解决冲突的文件。如果您使用git status
,则可能会看到列出的文件被“两者都更改”。在做任何事情之前,你需要照顾好这一点。
做git mergetool
它会一次调出一个文件。修复文件以便解决冲突,然后您应该可以继续。
请参阅我的编辑我的问题作出。我的意思是我修改的文件和'git status'返回的文件是一样的。我应该如何解决我遇到的问题? – xan 2013-05-08 15:05:51
你需要解决冲突或'git reset'文件到非冲突状态。取决于你做了什么导致冲突。 – Schleis 2013-05-08 16:40:37