2010-07-01 38 views

回答

5

這裏有幾個問題需要考慮:

淺克隆:您可以將--depth <depth>參數添加到git clone拿到倉庫的淺表副本。例如如果<depth>爲1,則表示該克隆將僅抓取最近提交所需的文件。然而,這樣的倉庫有上,你可以跟他們做什麼尷尬的限制,如git clone手冊頁概述:

 
     --depth 
      Create a shallow clone with a history truncated to the specified 
      number of revisions. A shallow repository has a number of 
      limitations (you cannot clone or fetch from it, nor push from nor 
      into it), but is adequate if you are only interested in the recent 
      history of a large project with a long history, and would want to 
      send in fixes as patches. 

事實上,在this thread討論這是言過其實的東西 - 有些情況下,從推有用的情況下,淺層克隆仍然可以工作,並且可能適合您的工作流程。

斯科特查孔的「混帳媒體」擴展:筆者對此進行了回答this similar question並在GitHub上的自述:http://github.com/schacon/git-media

淺子模塊:您可以將所有大文件保存在單獨的git存儲庫中,並將其作爲shallow submodule添加到主存儲庫。這樣做的好處是,您沒有淺碼克隆對代碼的限制,只是具有大文件的存儲庫。

還有很多方法可以通過在git掛鉤中添加掛鉤(例如)在你的大文件中使用rsync,但我認爲有很好的理由希望將這些文件保存在git的控制下首先。

我希望這有些幫助。

+0

git-media看起來正是我想要的,但它還沒有完成。儘管如此,我認爲我的工作有點黑客。現在我只需要支持將文件上傳到我希望他們去的地方。 – davr 2010-07-02 18:27:31

+0

爲了將來的參考,這裏是我的git-media的一些改動:http://github.com/davr/git-media – davr 2010-07-03 15:51:29

+0

太棒了,看起來非常有用!就像另一個興趣點一樣,這裏的線程(特別是第一封郵件中鏈接的幻燈片)對於處理大文件的git主題很有意思http://git.661346.n2.nabble.com/Git-and -Media-repositories-td1446700.html – 2010-07-03 18:45:48