Need help with update to latest Git using Terminal

githomebrewpathterminal

I was trying to update to the latest Git version in my Terminal. I've no clue what I did and all I remember was that I removed the previous installed Git I think because when i run the following commands:

which git => /usr/local/bin/git
git --version => -bash: /usr/bin/git: No such file or directory
brew install git => Warning: git-2.2.1 already installed
brew doctor => Your system is ready to brew.
brew link git => Warning: Already linked: /usr/local/Cellar/git/2.2.1
$PATH => "/usr/local:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/local/bin:/usr/bin:/bin:‌​/usr/sbin:/sbin"

My question is what should i do next so that I can use Git ?

Best Answer

I suspect that git's location is still cached in /usr/bin (the default location). To check this, type:

type git

The result will likely be:

git is hashed (/usr/bin/git)

To fix this, you can simply log out & back in, or clear the hash for git with the following:

hash -d git

Now, running git should work properly.