How do I correctly install the tools in git's contrib directory?

Viewed 11294

Git includes a set of tools contributed by third parties. I'm not sure how I'm supposed to use these tools correctly.

For example, I'd like to use git-subtree. There seem to be a number of ways I could use this:

  1. Copy to my path

     cp /path/to/git-subtree.sh /usr/local/bin/git-subtree
     chmod +x /usr/local/bin/git-subtree
    

    Works fine, feels a bit hacky.

  2. Symlink to my path

     chmod +x /path/to/git-subtree.sh
     ln -s /path/to/git-subtree.sh /usr/local/bin/git-subtree
    

    Also works, feels marginally less hacky

  3. Use a git alias

    Add the following to my global .gitconfig file:

     [alias]
         subtree = !/path/to/git-subtree.sh
    

    Then good old chmod again:

     chmod +x /path/to/git-subtree.sh
    

    Works, feels all nice and git-ish.

  4. Use the Makefile

    Per the INSTALL file.

     cd /path/to/git-subtree.sh
     make
     make install
     make install-doc
    

    Doesn't work for me, it tries to install to a non-existent path. Perhaps this is because I installed git using homebrew rather than installing from source? I'm too lazy to investigate; I already have three working alternatives. :)

So my question is, which of these is the preferred way of installing git-contrib add-ons? Is there even a preferred way? Is there another option I haven't suggested that's better than the ones listed above?

5 Answers
Related