git from source on Centos 7

git logo

As for many packages, git is fairly old on CentOS 7. The version they provide lacks a feature that I rely on, namely the -C switch, to be able to call git anywhere, without having to cd to the git directory first.

These are the steps I took to build git on CentOS 7:

$ yum -y install gcc make gettext-devel openssl-devel \
  perl-devel curl-devel expat-devel
$ curl \
| tar xzf -
$ cd git-2.10.2
$ make prefix=/usr/local -j $(nproc)
$ make install prefix=/usr/local
$ git --version