Git包含set of tools contributed by third parties。我不知道我應該如何正確使用這些工具。例如,我想使用git-subtree。似乎有多種方式,我可以用這個:如何在git的contrib目錄中正確安裝工具?
複製到我的路徑
cp /path/to/git-subtree.sh /usr/local/bin/git-subtree chmod +x /usr/local/bin/git-subtree
工作正常,感覺有點哈克。
符號鏈接到我的路徑
chmod +x /path/to/git-subtree.sh ln -s /path/to/git-subtree.sh /usr/local/bin/git-subtree
同樣的作品,感覺稍微少哈克
使用Git的別名
以下內容添加到我的全球的.gitconfig文件:
[alias] subtree = !/path/to/git-subtree.sh
那麼好老搭配chmod再次:
chmod +x /path/to/git-subtree.sh
作品,感覺所有尼斯和git-ISH。
使用Makefile
cd /path/to/git-subtree.sh make make install make install-doc
對我不起作用,它會嘗試安裝到不存在的路徑。也許這是因爲我使用homebrew安裝git而不是從源代碼安裝?我懶得去調查;我已經有三種工作選擇。 :)
所以我的問題是,哪些是安裝git-contrib附加組件的首選方式?有沒有更好的方法?我還沒有提出另一個選擇,比上面列出的更好嗎?
你也可以將你的'PATH'變量指向git-contrib的東西。 – pmr 2012-07-23 13:33:22