我有一个git repo,其中包含一个相当大的子模块,需要在其中添加一些项目。我宁愿不克隆并检出整个工作树。
有了克隆,我可以做git clone <repo> --no-checkout
,但这似乎不是此子模块的选项。那是我目前的解决方案:
git clone <remote-path-to-MySubmodule> --no-checkout
cd MySubmodule
cp path/to/files/* .
git add path/to/files/*
git commit -m <message>
git push
但是感觉submodule
工作流程也应该允许这样做。
答案 0 :(得分:0)
我宁愿不克隆并检出整个工作树
如果您希望克隆存储库,但不需要完整的历史记录,请执行浅表克隆
# --branch=<branch> Clone only specific branch
# --depth=1 clone only the last 1 commits
git clone <url> --branch=<branch_name> --depth=<X>
git clone <url> --branch=master --depth=1
按照下面的注释中的要求
孤立分支是没有任何历史记录的分支。使用git checkout -b <name>
将使用当前分支的完整历史记录创建分支。
使用孤立分支创建没有历史的“孤立”分支。
git checkout --orphan branch_name