2013-05-08 117 views
17

我正在分支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 ..添加是什麼文件?

回答

11

既然你已經編輯衝突文件,你只需要

git add mod/assign/locallib.php 

然後

git cherry-pick --continue 
2

您試圖執行合併(通過git mergegit pull)並且具有未解決衝突的文件。如果您使用git status,則可能會看到列出的文件被「兩者都更改」。在做任何事情之前,你需要照顧好這一點。

git mergetool它會一次調出一個文件。修復文件以便解決衝突,然後您應該可以繼續。

+0

請參閱我的編輯我的問題作出。我的意思是我修改的文件和'git status'返回的文件是一樣的。我應該如何解決我遇到的問題? – xan 2013-05-08 15:05:51

+0

你需要解決衝突或'git reset'文件到非衝突狀態。取決於你做了什麼導致衝突。 – Schleis 2013-05-08 16:40:37