How to update Git (actually remove apple git and install new one via brew)? I want to update git. I find this article: 

On one of the first steps, I get a problem. When I tried to backup currently installed git I got permissions restriction. It's ok it must be some OSX system restriction. 

I checked PATH and noticed that /usr/bin is after /usr/local/bin. So if I just install new version of git via brew this version will be used (since brew installs everything into /usr/local/bin. I did that and the result frustrated me. Old git is using instead of installed via brew. Why?

Here is some output:

svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ git --version
git version 2.11.0 (Apple Git-81)

svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ which git
/usr/local/bin/git

svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ ls -al /usr/local/bin/git | grep git
lrwxr-xr-x  1 svlad  admin  28 Sep  3 18:16 /usr/local/bin/git -&gt; ../Cellar/git/2.14.1/bin/git

svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ /usr/local/Cellar/git/2.14.1/bin/git --version
git version 2.14.1

svlad at sharikovvlad in ~/sandbox/git-test on master [+]
$ echo $PATH
/Users/svlad/bin:/usr/local/opt/gnupg@1.4/libexec/gpgbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
$


So why apple git is using? /usr/local/bin is first in path so symlink from this folder must be used? So why I am getting old version?

Also, any thoughts how can I remove apple git?
You can try to remove CLI tools alone, which is what comes with Apple git and that may solve your problem.

CLI Tools Removal


https://gist.github.com/yoneken/3284561


if that didn't do it, that means that CLI Tools were downloaded separate from Xcode and you can try this to remove it:

sudo rm -rf /Library/Developer/CommandLineTools


Once that's gone you just check to make sure it got removed and then reinstall it with Homebrew. Hope this may help.