一半君的总结纸

听话只听一半君

Github如何fork两次以上

如果网页上点按钮,fork只能一次

因为我想把ilmbase,pyilmbase,openexr放在我fork的alembic的contrib目录下,但是从openexr官网下的ilmbase等文件里似乎没有cmakelists.txt, 只有github上的openexr repo里面有,可是 openexr repo里的ilmbase,pyilmbase,openexr 不是submodule(没有一个独立的repo),所以我这样乱搞行么,手动把 openexr repo fork三次,得到独立的ilmbase,pyilmbase,openexr repo, 然后再作为submodule加到我fork的alembic repo里的build\contrib下面

操作步骤:

  1. clone 原始的repo
    git clone https://github.com/openexr/openexr.git
    
  2. 把其他全删了,只留pyilmbase,然后把所有内容移出pyilmbase目录,放到根目录
    强迫症的用命令行搞定

    shopt -s extglob
    rm -rf !(PyIlmBase)
    mv PyIlmBase/* .[^.]* . 
    rm -rf PyIlmBase
    
  3. github新建一个空repo
  4. 添加remote:
    之前的状态

    $ git remote -v
    origin  https://github.com/openexr/openexr.git (fetch)
    origin  https://github.com/openexr/openexr.git (push)
    

    进行如下操作

    # 把origin改名成upstream
    git remote rename origin upstream
    
    # 添加刚才新建的空repo为origin
    git remote add origin git@github.com:oglops/PyIlmBase.git
    

    之后的状态

    $ git remote -v
    origin  git@github.com:oglops/PyIlmBase.git (fetch)
    origin  git@github.com:oglops/PyIlmBase.git (push)
    upstream        https://github.com/openexr/openexr.git (fetch)
    upstream        https://github.com/openexr/openexr.git (push)
    

    最后把本地repo推上去

    git push -u origin master
    
  5. 到我fork的alembic目录里,加这个submodule
    git submodule add git@github.com:oglops/PyIlmBase.git contrib\PyIlmBase-2.2.0
    
  6. 重复以上操作

lz的三个独立出来的submodule在此:
https://github.com/oglops/IlmBase
https://github.com/oglops/OpenEXR
https://github.com/oglops/PyIlmBase

照此教程:
Create multiple forks of a GitHub repo

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: