Error while trying to update brew package manager

Let me add: cd /usr/local/git and then run git reset --hard FETCH_HEAD


The accepted answer is correct but incomplete. If you are getting the error of

error: The following untracked working tree files would be overwritten by merge:

Then go to your terminal and run these commands

cd /usr/local

Then

git reset --hard FETCH_HEAD

Then

git checkout Library

That should get everything in order. Then run

brew update

There was a bug in Homebrew that was fixed just a few days ago. To fix the bug you can run git reset --hard FETCH_HEAD inside your Homebrew installation. Since that won't fix files that are already seen as modified you can also run git checkout Library to replace your checkout with the latest files. (That wipes all edits so take appropriate measures with any you made.)