Git specifies a directory for pull operations (to avoid polluting other directories)

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
insert image description here

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.
insert image description here
Notepad opens the sparse-checkout file to add

/目录/

Guess you like

Origin blog.csdn.net/weixin_41891519/article/details/121473710