2013-07-25 55 views
65

我運行:家釀更新失敗:「請提交更改或藏匿,然後才能合併」

brew update 

我得到一個錯誤:

error: Your local changes to the following files would be overwritten by merge: 
    samtools.rb 
Please, commit your changes or stash them before you can merge. 
Aborting 

事實證明,這是一個衆所周知的錯誤。事實上,它提到的Homebrew wiki

After running brew update, you receive a git error warning about untracked files or local changes that would be overwritten by a checkout or merge, followed by a list of files inside your Homebrew installation. 

This is caused by an old bug in in the update code that has long since been fixed. However, the nature of the bug requires that you do the following: 

cd $(brew --repository) 
git reset --hard FETCH_HEAD 

If brew doctor still complains about uncommitted modifications, also run this command: 

cd $(brew --repository)/Library 
git clean -fd 

我跟着這些指示和我仍看到同樣的錯誤。哪裏不對?

回答

104

我能夠自己解決問題。

什麼讓我關閉運行「git狀態」沒有顯示該文件。

除了使用常見的解決方案:

cd $(brew --repository) 
git reset --hard FETCH_HEAD 

我不得不這樣做:

cd [directory of the file in question] 
git reset --hard FETCH_HEAD 

這解決了這個問題。

+0

謝謝!它修復了我的一個git衝突。 git reset --hard FETCH_HEAD究竟是什麼? –

+0

當我有這個問題時,我不得不rm在/ usr/local/Formula/Library中的有問題的文件,然後「git reset --hard FETCH_HEAD」後沖泡更新工作 – petrocket

+0

這是爲我做的,非常感謝你共享的! –

2

我後numpy的公式中手動修正網址有這個問題。我後來可以通過以下方式糾正:

cd /usr/local/Library/Taps/homebrew/homebrew-python 
git checkout -- numpy.rb 
brew update 
相關問題