The easiest way to update git to 2.2.1 or higher is to use homebrew.

If you get a command not found error, you can install homebrew from brew.sh (scroll down for a one liner, i won’t copy it here in case it updates). If you get a different error, check out Updating homebrew on yosemite.