John
John

Reputation: 1178

How do I install subtree that ships with official Git install?

I downloaded and installed the latest Git version 1.8.4.2 from http://git-scm.com. I expected various third party Git modules such as Subtree to be available in /usr/local/git/contrib for installation. However, the contrib folder only contains a single folder (completion) inside of it and no other files or folders.

So I have two questions:

Why are modules missing from the contrib folder?

How do I install Subtree in absence of the same from the contrib folder? (I would prefer installing Subtree from official Git source rather than from https://github.com/apenwarr/git-subtree which is now an obsolete repo)

BTW, I'm running OS X Mavericks

Upvotes: 9

Views: 8681

Answers (3)

brookbot
brookbot

Reputation: 473

git subtree install appears to be broken in the latest git version 2.27.0

https://github.com/git/git

I built and installed from top level no problem: make; make install.

git: 'subtree' is not a git command. See 'git --help'.

Switched to contrib/subtree, make; make install. Still no subtree command. Tried make prefix=~/; make prefix=~/ install. Still no subtree command.

Turns out git-subtree was infact siting there in contrib/subtree. So I copied it to ~/bin and now it works (smoke coming out of head...).

Upvotes: 0

Eemeli Kantola
Eemeli Kantola

Reputation: 5557

The current Homebrew-installed git (v2.4.1) does seem to come with git-subtree out of box. Just doing brew install git or brew update && brew upgrade git might do the trick.

Upvotes: 1

johnb003
johnb003

Reputation: 1909

There are a couple ways to install git subtree on mac depending on how you installed git on your system.

With Homebrew

If you used homebrew to install git then subtree, along with the rest of the git contrib items, was already placed on your system and can be installed. To install subtree:

  1. Fire up a terminal and go to /usr/local/share/git-core/contrib/subtree.
  2. Run make which will prepare subtree.
  3. Run make prefix=/usr/local/opt/git/ install. The prefix is important because the default location the makefile knows about is not where it needs to be installed with homebrew.

Git From Installer

If you downloaded and installed git using the installer from the git website there is a different method to installing git-subtree:

  1. Since git contrib was not put on your system you'll need to checkout the git source. Don't worry about compiling or installing git. You just need access to the contrib director to install subtree (which is mostly shell scripts).
  2. In a terminal go into the git/contrib/subtree directory.
  3. Run make to prepare subtree.
  4. Run sudo make prefix=/usr install. The prefix is important for it to be installed in the right location. Note, you need to use sudo to install this because of it's location on the system.
  5. Remove the git source (unless you want to keep it around for another reason).

reference: how-to-install-git-subtree

Upvotes: 11

Related Questions