引言
OpenHarmony中applications_app_samples仓中有很多工程,全部下载会消耗大量时间;如果只需要修改其中某一个工程,只下载所需工程的文件夹就高效很多。本文以下载code/UI/ArkTsComponentCollection/ComponentCollection工程为例,介绍在windows下checkout特定应用的方法
使用TortoiseGit下载部分文件
TortoiseGit是作者习惯使用的图形化工具,查询资料和摸索后发下该工具可以支持指定文件夹checkout,具体步骤如下
step1、clone仓库时不做checkout
step2、修改git配置为稀疏下载模式并指定下载目录
a、修改.git/config文件,增加或修改稀疏功能 sparsecheckout = true
b、在.git\info目录下新建sparse-checkout文件;文件中写入期望的目录或文件
本例中则写为
code/UI/ArkTsComponentCollection/ComponentCollection
step3、checkout
后面提交代码等操作和正常模式相同
使用git-bash命令
git的bash命令和linux下命令行操作方法相同,习惯使用命令行的开发者也可以稀疏下载
step1、在下载目录中启动bash.exe
step2、使用git命令配置并下载工程
git init
git remote add origin https://gitee.com/shitijun/applications_app_samples.git
git sparse-checkout set core.sparseCheckout
git sparse-checkout set code/UI/ArkTsComponentCollection/ComponentCollection
git pull
git checkout master
都实操一遍后,觉得我这种俗人还是喜欢图形化工具,哈哈
参考资料
https://blog.csdn.net/u011623102/article/details/109921064
https://git-scm.com/docs/git-sparse-checkout |