Entering:
export PATH=/usr/local/bin:$PATH
and thengit --version
will temporarily get your console to show the updated version. But once you exit out of the Terminal and reopen the Terminal, your computer will go back to its old ways again.That means that
which git
tells you/usr/bin/git
instead of/usr/local/bin/git
You want /usr/local/bin/git because that is where the newer version is installed.Why, computer gods, why??
It's really quite simple. Your computer does not hate you. It's just following the instructions located in its .bash_profile.
To tell it what you want it to do, you need to edit your bash profile.
In Terminal, type the following commands:
cd
touch .bash_profile
Your .bash_profile will open in TextEdit. Add this line to the file:open -a "TextEdit" .bash_profile
export PATH="/usr/local/bin:$PATH"
Save it and enter this in the Terminal to finalize the change:source .bash_profile
Now you have to link your Homebrew git, by saying
brew link git
Now (FINALLY), which git should say /usr/local/bin/git
...which is where Homebrew's updated git version should be located. Success!
Now every time you need to update your git, you just say:
brew update
brew upgrade git
That's it! Awesome.
A million thanks to the kind helpers who shared their wisdom via the following threads:
A million thanks to the kind helpers who shared their wisdom via the following threads:
http://superuser.com/questions/409501/edit-bash-profile-in-os-x
http://superuser.com/questions/708601/homebrew-cant-link-git