You can use which git
to find which version of git is used and its path.
To use the most updated version you could either call it with its full path returned by which, or create a bash alias like that:
alias git='/usr/local/git'
This would only be saved for current bash session. To save it for future usages, you'll have to create/modify your ~/.profile
file (where ~
is the path to your Home directory, like /Users/lucas/
)
It's an invisible file and you won't see it in the Finder by default.
To see if such file already exists and edit it, go to your home directory :
cd
Then list all files, including hidden files : ls -al
(a
is for all files and l
to output the list in list format, not column)
You can see in the far-right column, filenames, in which we will look for .profile file.
If you see it, open it with TextEdit from Terminal : open .profile
Otherwise, if it do not exists, simply open TextEdit and create a new file:
We should have something like this :
#!/bin/bash
alias git='/usr/local/bin/git'
Save it as .profile
, close your Terminal window and create a new one.
It should work ! :)