How to restore default Apple Version of Git after renaming it in Mac OS Mojave and linking git to homebrew version?
Shells remember the paths to commands you've executed during a session. You can use the hash
command to manage the remembered paths (from man bash
):
hash [-lr] [-p filename] [-dt] [name]
For each name, the full file name of the command is determined by searching the directories
in $PATH and remembered. If the -p option is supplied, no path search is performed, and filename
is used as the full file name of the command. The -r option causes the shell to forget all
remembered locations. The -d option causes the shell to forget the remembered location of each
name. If the -t option is supplied, the full pathname to which each name corresponds is printed.
If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname.
The -l option causes output to be displayed in a format that may be reused as input. If no arguments
are given, or if only -l is supplied, information about remembered commands is printed. The
return status is true unless a name is not found or an invalid option is supplied.
Run hash -r
to clear any command paths your shell has cached (or hash -d git
to just remove the entry for git
). Opening a new Terminal tab/window has the same effect.