2016-05-06 33 views
3

我運行Xcode,它自動運行git操作。這可能會導致一些rebase -i操作失敗,如果Xcode啓動操作比git更快。這導致:如何在「無法創建'.git/index.lock':文件存在」後繼續重新綁定。「?

fatal: Unable to create '.git/index.lock': File exists. 

If no other git process is currently running, this probably means a 
git process crashed in this repository earlier. Make sure no other git 
process is running and remove the file manually to continue. 

Xcode的任務完成之前,我可以做任何事情,所以index.lock已經過去了,我應該準備好繼續。

好的,所以我試試git rebase --continue,因爲其他操作已經完成了,現在應該沒有index.lock了。然而,這迅速鼓起,一個錯誤信息,如:

The previous cherry-pick is now empty, possibly due to conflict resolution. 
If you wish to commit it anyway, use: 

    git commit --allow-empty 

Otherwise, please use 'git reset' 
interactive rebase in progress; onto abcdef 
Last commands done (X commands done): 
    pick abcdef Something 
    pick abcdef Something 
Next commands to do (Y remaining commands): 
    pick abcdef Something 
    pick abcdef Something 
You are currently rebasing branch 'foo' on 'abcdef'. 

nothing to commit, working directory clean 
Could not apply abcdef 

在這一點上,我乾脆放棄,--abort,並再次啓動。我失去了我制定的重組策略,以及我解決的任何衝突。我能做些什麼來正確恢復這個過程,不會丟失任何數據?

對於這個問題,「重新綁定之前關閉Xcode」並不是我正在尋找的答案。假設我已經忘記這麼做了,並且處於這種不良狀態(另外,Xcode需要永久啓動,而且這種情況很少發生)。

回答

2

繼續執行git rebase --continue不起作用,因爲git在實際應用相關修補程序之前失敗。但是,你可以手動:

git apply .git/rebase-apply/patch 

然後,如果有必要解決衝突,並使用git add更改的文件添加到索引,最後,使用git rebase --continue

0

該提交引入的所有更改已由您當前分支上的一些提交引入。

git cherry-pick not working

+0

當我重新運行rebase時,它應用乾淨(或至少會產生相同的衝突)。 – JHZ

1

我目前追着生產鎖錯誤的鬼在你的問題就來了。我還沒有找到繼續轉發的方法,但是您可以在全球爲您的用戶啓用git config --global rerere.enabled 1的rerere(重新使用記錄的分辨率)。這既不能解決git rebase中明顯的競爭條件,也不能讓你繼續進行rebase,但是當它重試使它不那麼痛苦時,它會重新應用你的衝突解決方案。

相關問題