Max*_*ams 3 git sparse-checkout
我有一个git repo,我只想下载某些子文件夹.我的配置如下所示:
#.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sparsecheckout = true
[remote "dreamhost"]
url = <repo url>
fetch = +refs/heads/*:refs/remotes/dreamhost/*
[push]
default = tracking
Run Code Online (Sandbox Code Playgroud)
在.git/info/sparse-checkout我有这个:
themes/theme1
themes/theme8
Run Code Online (Sandbox Code Playgroud)
这是themes我想要的子文件夹中的文件夹.(我不需要其他人,其中很多).
如果我做一个git/pull我可以看到git获取很多东西,包括themes我不想要的子文件夹,这很好.我知道稀疏结账仍然会拉下物体.
我现在想要一份副本themes/theme15,进行一些修改.所以,我.git/info/sparse-checkout这样编辑:
themes/theme1
themes/theme8
themes/theme15
Run Code Online (Sandbox Code Playgroud)
然后做了一个git pull dreamhost master,认为git会添加theme15文件夹themes.但是,没有任何反应 - 它只是说
From <repo url>
* branch master -> FETCH_HEAD
Already up-to-date.
Run Code Online (Sandbox Code Playgroud)
和文件夹不在那里.谁能告诉我我做错了什么?编辑后还有一个额外的步骤.git/info/sparse-checkout吗?
谢谢,马克斯
编辑:这是git version 2.8.1顺便说一句
刚刚弄清楚这个问题,如果其他人也遇到同样的问题,我会回答它。
进行更改后我需要做
git checkout themes/theme15
Run Code Online (Sandbox Code Playgroud)
然后出现该文件夹。也许事后看来是显而易见的……(也许不是)。