我在运行:
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
我按照这些说明进行操作,但仍然看到同样的错误。怎么了?
最佳答案
我能够自己解决问题。
提示我运行“git status”时没有显示该文件。
而不是使用通用解决方案:
cd $(brew --repository)
git reset --hard FETCH_HEAD
我必须做的:
cd [directory of the file in question]
git reset --hard FETCH_HEAD
这解决了问题。
关于macos - Homebrew 软件更新失败 : "Please, commit your changes or stash them before you can merge",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17868956/