-
-
Save cweekly/10329382 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew update | |
brew versions FORMULA | |
cd `brew --prefix` | |
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions" | |
brew install FORMULA | |
brew switch FORMULA VERSION | |
git checkout -- Library/Formula/FORMULA.rb # reset formula | |
## Example: Switch to git 1.9.0 in particular: | |
# | |
# $ brew versions git | |
## [ignore the warning about "brew-versions" being unsupported; it works well today] | |
# 1.9.1 git checkout 6801305 Library/Formula/git.rb | |
# 1.9.0 git checkout e2d162d Library/Formula/git.rb | |
# 1.8.5.5 git checkout 2fe5763 Library/Formula/git.rb | |
# 1.8.5.4 git checkout 5c6cb18 Library/Formula/git.rb | |
## ... etc ... | |
# | |
# $ cd `brew --prefix` | |
# | |
## copy/paste the 1.9.0 line above like so: | |
# $ git checkout e2d162d Library/Formula/git.rb | |
# | |
# $ brew install git | |
# | |
# $ brew switch git 1.9.0 | |
# | |
# $ git checkout -- Library/Formula/git.rb | |
# | |
# $ git --version | |
# git version 1.9.0 | |
# | |
## DONE :) |
Thanks Michael! Yeah, doing what brew says to do along the way is... the right thing to do.
Note if you have multiple versions of a formula installed, "brew link" may not work, hence "brew switch".
(Maybe you hadn't previously used brew to manage your git?) YMMV.
I'm not a homebrew expert, just sharing what worked for me. :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After this step:
$ git checkout e2d162d Library/Formula/git.rb
I had to "brew unlink git" before installing.
I didn't have to:
$ brew switch git 1.9.0
$ git checkout -- Library/Formula/git.rb