Can I use brew to upgrade this version?
No. That is the default version installed by Xcode / developer tools. I would leave it as-is.
Or would brew install git in a separate location?
Yes, in /usr/local/bin/git
, which links to a version installed in /usr/local/Cellar
.
(Note that unlike Homebrew, the official OS X Git Installer installs to /usr/local/git/bin
.)
How would my terminal know which version/location of git to run? Was I supposed to update PATH in my shell after installing brew?
Typically you don't need to because Homebrew by default does not ship anything that comes with OS X anyway. But if you want Homebrew commands that are duplicates of native commands to come first, edit your PATH in your ~/.bash_profile
:
export PATH=/usr/local/bin:$PATH
After a restart of the shell or re-sourcing the path, the git
should come from Homebrew. Run which -a git
to see all installed Git binaries.
How would spotlight know which version/location of git to use?
I'm not sure what the purpose would be, since Spotlight is used for finding documents that can be opened in some application—or GUI applications—but git
by itself cannot be opened.
I suspect that Spotlight does not find any of the git
executables unless they exist in your user's home directory, e.g. ~/bin
.