A while back I cloned homebrew in order to add a new formula. Since then, whenever I do a brew upgrade, I get a new git merge window in MacVim (my default editor) with the contents "Merge branch 'master' of https://github.com/mxcl/homebrew".After saving the buffer, the update proceeds as usual.
Checking git status in the homebrew directory (/usr/local/) gives:
# On branch master
nothing to commit (working directory clean)
brew doctor gives no errors. This is an annoying problem, and I haven't been able to find any solutions by searching.
This is normal if you've made any changes in /usr/local/Library. When that message appears in your editor, use Shift+ZZ to save and exit. Your update will proceed normally with the only new thing being the commit message you accepted and saved, viewable using brew log --oneline.
brew log --oneline
On Lion with the system git, this message didn't appear. It's a new git feature, and it can be turned off with an environment variable (I forget which).
I'm using the homebrew version of git:
$ git --version
git version 126.96.36.199
$ which git
The only change I made to /usr/local/Library was adding the new formula. Once it was merged into homebrew, I switched back to the main repository (instead of my clone).
Searching the git docs, I found what I think is the correct environment variable. export GIT_MERGE_AUTOEDIT='no'. I've set this but will have to wait until the next update to test.
Not a Homebrew bug. if it wants you to merge everytime then you are merging everytime, I suggest you hard reset.
I did git reset --hard in /usr/local/ but I still have MacVim asking for a merge message every time I brew update.
git reset --hard
Is there anything else I should try?
I imagine you hard reset to your fork rather than to mine. Try again.
In case anyone else is experiencing this same issue, I was seeing the same behavior and was able to fix it by issuing "git reset --hard origin/master" in /usr/local.
I ram upon a similar issue, and I've been ignoring it for a while. (I just fixed it.) I didn't (consciously) edit any files. I'm pretty sure the changes were caused through normal use of the brew command; but I don't really know or care. I agree Not a Homebrew bug. However, the user experience could be enhanced.
$ brew update
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
All it said was 'Library'. Does it mean: ~/Library/, /Library/, /System/Library/? I had no idea, and of corse the answer was none of the above. Having a hint to where the issue was would have been helpful.
To help my coworkers who are new to git, I've pasted the following commands:
git stash save broken && git branch -M master broken && git checkout master
git reset --hard && git branch -M master broken && git checkout master && git branch -D broken
It's a last resort, "I have no idea what's going on. Just make it work again!" It has saved a few soles from rm -f and git cloning a repo. Is there any harm in adding a brew update force that branches, stashes, or just discards anything that a non-brew hacker doesn't care about?
brew update force
If they know what they've done, they can fix it. If they don't care, they just don't care.
git reset --hard origin/master did the trick for me, thanks @timgilbert!
git reset --hard origin/master