git clone 大项目

如果使用git作为source管理工具的话,我们往往会遇到随着项目的进展git仓库越来越大,要想clone一个项目需要很长的时间.下面介绍自己在工作中用到的几种优化方式

浅clone

git clone --branch develop --depth=1 [email protected]:xx.git

上面的命令中使用了branch和depth

depth

depth参数可以让git只clone指定数量的commit记录,从而缩短clone的时间

官方文档:

Create a shallow clone with a history truncated to the specified
number of commits. Implies --single-branch unless --no-single-branch
is given to fetch the histories near the tips of all branches. If you
want to clone submodules shallowly, also pass --shallow-submodules.

branch

当远端有多个分支的时候,使用branch来指定clone哪一个分支,否则将会clone仓库中的HEAD

官方文档:

Instead of pointing the newly created HEAD to the branch pointed to
by the cloned repository’s HEAD, point to <name> branch instead. In a
non-bare repository, this is the branch that will be checked out.
--branch can also take
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值