搜尋

首頁  >  問答  >  主體

git - 如何clone倉庫的一個文件

有project ,newstart.
它裡面的檔案如下
test1
test2
LICENSE
README.md

git clone https://github.com/someone/ne... /tmp/newstart
會拉取全部的四個檔案。
test1
test2
LICENSE
README.md

現在我想只是獲得test1這個資料夾和它裡面的全部東西,請問,有無辦法做到?

漂亮男人漂亮男人2841 天前700

全部回覆(1)我來回復

  • PHPz

    PHPz2017-05-02 09:47:54

    需要git1.7以上

    $ mkdir test
    $ cd test
    $ git init
    $ git remote add -f origin https://github.com/Rozbo/puck.git
    $ git config core.sparsecheckout true #开启Sparse Checkout模式
    $ echo "app" >> .git/info/sparse-checkout #设置仅拉取app这个文件夹
    $ git pull origin master

    回覆
    0
  • 取消回覆