Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

brew update result in git merge message in editor #13987

Closed
tonymcdaniel opened this Issue · 8 comments

6 participants

@tonymcdaniel

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.

@2bits

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.

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).

@tonymcdaniel

I'm using the homebrew version of git:
$ git --version
git version 1.7.11.3

$ which git
/usr/local/bin/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.

@mxcl
Collaborator

Not a Homebrew bug. if it wants you to merge everytime then you are merging everytime, I suggest you hard reset.

@mxcl mxcl closed this
@tonymcdaniel

I did git reset --hard in /usr/local/ but I still have MacVim asking for a merge message every time I brew update.

Is there anything else I should try?

@mxcl
Collaborator

I imagine you hard reset to your fork rather than to mine. Try again.

@timgilbert

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.

@whitehat101

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.

the error:

$ brew update
error: Your local changes to the following files would be overwritten by merge:
    Library/Contributions/cmds/brew-pull.rb
    Library/Contributions/cmds/brew-services.rb
    Library/Contributions/cmds/brew-test-bot.rb
    Library/Contributions/manpages/brew.1.md
    Library/ENV/4.3/make
Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:
    Library/Aliases/ag
    Library/Aliases/qt4

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-omega-13
git stash save broken && git branch -M master broken && git checkout master
# git-omega-13-kill
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?

If they know what they've done, they can fix it. If they don't care, they just don't care.

@mariussoutier

git reset --hard origin/master did the trick for me, thanks @timgilbert!

@mistydemeo mistydemeo locked and limited conversation to collaborators
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Something went wrong with that request. Please try again.