I wanted Mac OS to use my homebrew version of git after brew install git
. So I mistakenly renamed my Apple Default git by doing:
$mv /usr/bin/git /usr/bin/git~apple
$ git --version
git version 2.25.0
I am attempting to uninstall the homebrew version of git, and revert back to the Apple version of git.
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
$ which git
/usr/local/bin/git
$ brew uninstall git
Uninstalling /usr/local/Cellar/git/2.25.0... (1,523 files, 45.6MB)
$cp /usr/bin/git~apple /usr/bin/git
$mv /usr/bin/git~apple /usr/bin/git
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
$ which git
/usr/bin/git
$ git --version
-bash: /usr/local/bin/git: No such file or directory
It seems like after uninstalling homebrew and moving the original git file back to its location, which git finds the correct $PATH for git, but git --version cannot find git. How do I properly restore the original Apple version of git?