V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
fkccp
V2EX  ›  git

git怎么能只clone某个项目的某个目录?submodule时用

  •  
  •   fkccp · Mar 7, 2013 · 26730 views
    This topic created in 4803 days ago, the information mentioned may be changed or developed.
    最近要做个站,代码放在github上,打算使用codeigniter框架,其核心是项目里的system这个目录。
    本来是打算直接整目录拷过来放到我的项目中的,但是觉得这样有些浪费,毕竟system的代码github上已经有了,然后打算用git的submodle这个功能,但是貌似不能把ci的system作为submodule放到我的项目中,不知道各位有木有什么办法?

    另:google过程中也没有见到有git clone某个目录的,比如整个源代码非常大,好几个G,或者对源代码中大量的测试代码没有兴趣,不想全部clone,不知道有没有什么方法。

    不胜感激~

    ^_^
    8 replies    2016-07-26 22:15:56 +08:00
    cloudzhou
        1
    cloudzhou  
       Mar 7, 2013   ❤️ 1
    看看zhihu http://www.zhihu.com/question/20462239
    这个问题是我比较疑惑的,svn拥有精确到目录的权限控制,git就没办法那么简单了。
    soulhacker
        3
    soulhacker  
       Mar 7, 2013
    现在没有,以后应该也不会有。这和 git 的基本模式有关,整个 repo 是一个整体。

    如果希望提供给别人方便的引用为 submodule 的话,最好把希望重用的代码和其他部分分开 repo。
    fkccp
        4
    fkccp  
    OP
       Mar 7, 2013
    @soulhacker

    嗯,刚写了issue,然后发现勉强有了解决办法。

    https://github.com/EllisLab/CodeIgniter/issues/2311
    halfblood
        5
    halfblood  
       Mar 7, 2013
    submodule貌似很强大啊!
    ensonmj
        6
    ensonmj  
       Mar 8, 2013 via iPad
    @cloudzhou svn精确到目录是因为每个目录下面都有个.svn目录,git只在根目录下保存元数据。新版的svn据说也改成这种方式了
    lyf362345
        7
    lyf362345  
       Nov 14, 2014
    我也碰到这个问题了, 我的问题是 svn 是放脚本和配置什么的, 需要单独检出, 分开权限
    不行就跑一个 gitlab, 跑一个 svn 了, 有些场景还是 svn 比较合适
    neo1218
        8
    neo1218  
       Jul 26, 2016
    我写了一个脚本工具: https://github.com/neo1218/c
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2458 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 05:55 · PVG 13:55 · LAX 22:55 · JFK 01:55
    ♥ Do have faith in what you're doing.