Homebrew update fail: "Please, commit your changes or stash them before you can merge"

Solution 1:

I was able to resolve the issue myself.

What tipped me off is running "git status" did not show that file.

Instead of using the common solution:

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

I had to do:

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

That resolved the problem.

Solution 2:

This fixed it for me:

https://stackoverflow.com/a/20138806

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

Solution 3:

I had this problem after manually correcting a URL in the numpy formula. I was able to correct this later by:

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