Homebrew update error that local changes would be overwritten

2

I'm very new to homebrew and git.

I've done changes to httpd24.rb formula which is in homebrew/apache tap. (Just added the --enable-so configuration argument in the existing formula file)

Now when trying to brew update I'm getting this:

$ brew update
error: Your local changes to the following files would be overwritten by merge:
    httpd24.rb
Please, commit your changes or stash them before you can merge.
Aborting
Error: Failed to update tap: homebrew/apache
Already up-to-date.

Also got this:

$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    Library/Formula/httpd24.rb

nothing added to commit but untracked files present (use "git add" to track)

How can I save the changes to formula and be able to keep homebrew updated?

Drew

Posted 2015-06-05T01:38:23.077

Reputation: 1 628

Answers

0

Please, commit your changes or stash them before you can merge.

Commit you changes git add Library/Formula/httpd24.rb && git commit -m "This is your commit message".

When you run brew update it's work similar to git pull command. If you have non-committed changes you cannot update local repository.

Anton Dozortsev

Posted 2015-06-05T01:38:23.077

Reputation: 2 744

Thanx, Anton, but it didn't work - still the same error – Drew – 2015-06-05T18:56:45.297

Kstati, mojet eto byt' iz-za togo, chto eto formula ne iz defoltnogo repozitoriya, a iz tap-repo (homebrew/apache/httpd24)? Do I miss anything? – Drew – 2015-06-05T19:08:15.990

@Andrew Ты добавил и закоммитил файл httpd24.rb и у тебя всьо тажеш ошыбка? Your local changes to the following files would be overwritten by merge: httpd24.rb – Anton Dozortsev – 2015-06-05T19:50:35.093

да, абсолютно то же выдает – Drew – 2015-06-05T20:24:13.320

Страно, если ты выполниш git status -s и тебе выдаст http24.rb файлы то ты так его и не закомител. Ладно тут у многих такая же проблема была 1, 2 и 3

– Anton Dozortsev – 2015-06-06T13:55:44.537

Cпасибо, Антон! Я наконец разобрался: git add /usr/local/Library/Taps/homebrew/homebrew-apache/httpd24.rb && git commit -m "commit msg" решила мою проблему. Как я и подозревал проблема в пути к файлу httpd24.rb из-за того, что формула не из дефолтного репо. Я не знал как проверить успешность коммита, что и помогло мне найти мою ошибку. Так что засчитываю ответ. – Drew – 2015-06-06T17:55:18.900

2

Try this:

cd $(brew --repository)
git reset --hard FETCH_HEAD

Source: Common Issues with Homebrew.

kjoonlee

Posted 2015-06-05T01:38:23.077

Reputation: 51

Doesn't work. I've also tried : cd $(brew --repository)/Library && git clean -fd - No luck, still the same message ((( – Drew – 2015-06-06T05:50:28.907

0

To fix Homebrew issues, run these commands:

git --git-dir $(brew --repository)/.git reset origin/master --hard
git --git-dir $(brew --repository)/.git clean -fd

For Git issues, see:

kenorb

Posted 2015-06-05T01:38:23.077

Reputation: 16 795