【问题标题】:Pulling all files within a subfolder in Git repository拉取 Git 存储库中子文件夹中的所有文件
【发布时间】:2017-02-01 22:44:31
【问题描述】:

我正在尝试提取我的 git 存储库中特定文件夹中的所有文件和文件夹。我已经尝试过使用 sparce-checkout 但这会拉出特定的文件夹。我希望它只提取文件夹的文件。

我有一个名为 /EWINS/ 的文件夹,我希望提取该目录中的每个文件夹和文件。

我试过了:

git 初始化

git config core.sparseCheckout true

git remote add -f origin https://MYDIRECTORY

echo "EWINS/*" >> .git/info/sparse-checkout

git pull origin master

但是,这会导致文件夹 EWINS 被拉出,因为我需要 EWINS 中的所有项目。

我参考过: How do I clone a subdirectory only of a Git repository?

http://lakehanne.github.io/git-sparse-checkout

任何帮助将不胜感激。

【问题讨论】:

    标签: git github directory bitbucket pull


    【解决方案1】:

    正如之前的 stack-overflow-er 已经回答的那样

    这称为 sparse checkout,从 1.7.0 版开始可用。

    “稀疏检出”允许稀疏地填充工作目录。它使用skip-worktree 位(参见git-update-index)告诉Git 工作目录中的文件是否值得查看。

    虽然$GIT_DIR/info/sparse-checkout 通常用于指定哪些文件在其中,但您也可以使用否定模式指定哪些文件不在其中。例如删除文件unwanted

    /*
    !unwanted
    

    详情请参阅linked answermanual

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-10
      • 1970-01-01
      • 2013-03-19
      • 2013-03-03
      相关资源
      最近更新 更多