Skip to content

Instantly share code, notes, and snippets.

@sirhc
Created April 17, 2015 03:44
Show Gist options
  • Save sirhc/34e68f1595a78189a8bf to your computer and use it in GitHub Desktop.
Save sirhc/34e68f1595a78189a8bf to your computer and use it in GitHub Desktop.
Install Git with Stow

Install Git with Stow

Git requires jumping through a hoop, since it will install a full tree under the specified prefix (e.g., $prefix/usr/local/bin/git).

A couple of convenience variables.

old=2.2.1     ;# old version installed with Stow
new=2.4.0-rc2 ;# new version to be installed with Stow

Fetch the source.

git clone https://github.com/git/git.git
cd git
git clean -dfx ;# if this path has been used to build before
git checkout v$new

Build Git, installing it to a temporary location.

PATH=/bin:/usr/bin:/usr/local/bin make prefix=/usr/local DESTDIR=/tmp/git-$new all doc info
PATH=/bin:/usr/bin:/usr/local/bin make prefix=/usr/local DESTDIR=/tmp/git-$new install install-doc install-html install-info

Move Git to the Stow directory.

sudo mkdir /usr/local/stow/git-$new
sudo mv /tmp/git-$new/usr/local/* /usr/local/stow/git-$new/

Stow the new Git.

sudo stow -d /usr/local/stow --delete git-$old
sudo stow -d /usr/local/stow --stow git-$new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment