When I tried updating homebrew/brew, the following error occurred:
brew update: The following untracked working tree files would be overwritten by merge
# cd /usr/local
# git fetch origin
# git reset --hard origin/master
as explained in the second answer, solved it. Source: