[Mac OSX] homebrew update error

Homebrew update 因本地 git 變更衝突而失敗的解法:進入 /usr/local 執行 git fetch origin 再 git reset --hard origin/master 即可修復。

failed log:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
$sudo brew update
error: Your local changes to the following files would be overwritten by merge:
    Library/Aliases/gperftools
    Library/Aliases/hashdeep
    Library/Aliases/htop
    Library/Aliases/nodejs
    Library/Aliases/ocio
    Library/Aliases/oiio
		....
error: The following untracked working tree files would be overwritten by merge:
	Library/Aliases/gperftools
    Library/Aliases/hashdeep
    Library/Aliases/htop
    Library/Aliases/nodejs
    Library/Aliases/ocio
    Library/Aliases/oiio
		....
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

Solution:

1
2
3
$ cd /usr/local
$ git fetch origin
$ git reset --hard origin/master

reference
[read]

comments powered by Disqus
Powered by Hugo. Theme Stack. All Rights Reserved.