Modify .git/config to enable sparsecheckout
1. The first git init initialization
2. The second type is performed on the original pulled git (you need to delete other folders and files other than the specified directory when the last step is completed)
Enter the .git/config file, open Notepad
add sparsecheckout=true
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
sparsecheckout = true #启用 sparsecheckout
[remote "origin"]
url = [email protected] #git仓库地址
fetch = +refs/heads/*:refs/remotes/origin/*
puttykeyfile = ""
[branch "master"]
remote = origin
merge = refs/heads/master
Specify the directory to pull
Enter .git/info to create a sparse-checkout file.
Notepad opens the sparse-checkout file to add
/目录/