通过git sparse-checkout 能够拉取部分代码

# 1.启用并初始化sparse-checkout
git sparse-checkout init
# 2.添加需要包含的目录或文件
git sparse-checkout set lib py mpy-cross ports/unix ports/windows
# 或者 在.git/info/sparse-checkout 文件(如没有请创建它)中添加文件路径,路径要相对仓库根目录的相对路径
# 3.拉取文件
git pull origin master 

如果想要拉取某个提交的变更文件

# 查看提交的修改记录
git log commit_id --name-only 
# 或
git log commit_id --stat
# 将文件路径拷贝到 .git/info/sparse-checkout 文件
# 执行sparse-checkout
git sparse-checkout init
git pull origin master
Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐