After an interrupted brew update because of a network issue, Homebrew appears to be broken:
$ brew update
error: pathspec \'master\' did not match a
In my case, I had just upgraded to OS X El Capitan and none of the other solutions worked.
I took note of the packages in /usr/local/Cellar and then deleted the Cellar folder and started with a fresh install.
rm -rf /usr/local/Cellar
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
Then I brew installed the packages again.