我如何在git的contrib目录中正确安装工具? [英] How do I correctly install the tools in git's contrib directory?

查看:209
本文介绍了我如何在git的contrib目录中正确安装工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Git包含第三方贡献的工具集。我不知道我该如何正确使用这些工具。



例如,我想使用 git的子树。我似乎有很多方法可以使用它:


  1. 复制到我的路径

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

    工作正常,感觉有点不好意思。

  2. 符合我路径的符号链接

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

    同样可以工作,感觉稍微少一些hacky

  3. 使用git alias



    将以下内容添加到我的全局.gitconfig文件中:

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

    然后再次使用旧的chmod:

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

    工作,感觉都很好,并且git-ish。


  4. 使用Makefile

    通过 INSTALL文件
    $ b $

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

    不适用于我,它会尝试安装到non-存在的道路。也许这是因为我使用 homebrew 安装了git,而不是从源代码安装?我懒得去调查;我已经有三种工作选择。 :)

所以我的问题是,哪些是安装git-contrib附加组件的首选方式?有没有更好的方法?还有另外一个选项,我没有建议比上面列出的更好吗? 解决方案

Contribs是一组有用的东西。你不把它们作为一个包安装。例如,要安装选项卡完成,只需从.bash_profile脚本获取该脚本即可。

至于从源码编译git



<$ p $在安装完所有的安装程序之后,

make
sudo make install

先决条件。


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?

解决方案

Contribs is a collection of helpful things. You don't install them as a package. For example, to install the tab completion, you simply source that script from your .bash_profile script. Each contrib in that folder has it's own way of using it.

as for compiling git from source

make
sudo make install

after you install all the prerequisites.

这篇关于我如何在git的contrib目录中正确安装工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆