Échec de la mise à jour du Homebrew: «S’il vous plaît, validez vos modifications ou rangez-les avant de pouvoir fusionner»

Je cours:

brew update 

Et j’ai une erreur:

 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 

Il s’avère que c’est une erreur bien connue. En fait, il est mentionné sur le wiki Homebrew :

 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 

J’ai suivi ces instructions et je vois toujours la même erreur. Qu’est-ce qui ne va pas?

J’ai pu résoudre le problème moi-même.

Ce qui m’a fait savoir, c’est que “git status” n’a pas montré ce fichier.

Au lieu d’utiliser la solution commune:

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

Je devais faire:

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

Cela a résolu le problème.

Cela a corrigé pour moi:

https://stackoverflow.com/a/20138806

 cd `brew --prefix` git fetch origin git reset --hard origin/master 

J’ai eu ce problème après avoir corrigé manuellement une URL dans la formule numpy. J’ai pu corriger cela plus tard par:

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