bur*_*ger 65 git macos homebrew
我在跑步:
brew update
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
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
Run Code Online (Sandbox Code Playgroud)
事实证明这是一个众所周知的错误.事实上,它在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
Run Code Online (Sandbox Code Playgroud)
我按照这些说明操作,仍然看到同样的错误.怎么了?
bur*_*ger 105
我自己能够解决这个问题.
让我失望的是运行"git status"没有显示该文件.
而不是使用通用的解决方案:
cd $(brew --repository)
git reset --hard FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)
我必须做:
cd [directory of the file in question]
git reset --hard FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)
这解决了这个问题.
小智 35
这为我修好了:
cd `brew --prefix`
git fetch origin
git reset --hard origin/master
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
37540 次 |
| 最近记录: |