Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
Learn Git in your browser for free with Try Git.
While there are multiple ways to install Git, the best way is to use Homebrew. Using Homebrew has the larger added benefit of using this install solution for other packaged app as well.
It is most likely that you have Git installed, but this is the core version installed with your OS. To see what version you are running, do the following:
$ which git
If you have not installed a newer version, you will most likely see this in your command prompt:
Now run this command to see what version you are running:
$ git --version
Again, most likely you will see something like this:
git version 126.96.36.199 (Apple Git-48)
This again is the version installed with your OS. The following instructions will walk you through installing a new version on your Mac.
Before you start anything, if you haven't installed XCode, install it now. You can download it via the App Store app on your Mac.
Installing is easy. Simply run this command in your Terminal app
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Running this command, there are a couple of things that may happen. Be sure to read all the instructions and follow them carefully. If there are things you don't understand, copy that line and search Google for the answer before just pushing forward.
If there is an older version installed and you wish to reinstall, you may be prompted to remove the previous version. I'd suggest not doing this.
Now that Homebrew is installed, to get Git installed, run the formula:
$ brew install git
The confusing part here is when you run
which git and
git --version, you will probably not see the correct version. To correct this, simply add the following line to your
.bash_profile. If you don't have this file, then you should create one.
which git and
git --version should return expected results for a new path and updated version of Git.
Could use some here here for these steps ;)