配置现有的git回购稀疏结帐 [英] configuring existing git repo for sparse checkout

查看:97
本文介绍了配置现有的git回购稀疏结帐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能配置现有的本地克隆git仓库进行稀疏结算?

指向执行 git init git remote add -f origin< repo> 这会导致我的情况很长的下载时间。



我本地已有一个存储库,我只想将其配置为稀疏检出,然后切换到特定分支。



非常感谢!

p>

解决方案

您仍然可以使用此答案: https://stackoverflow.com/a/4909267/2253302



但是你应该跳过一些步骤(即 git init git remote add -f origin< repo> )。我在我的测试回购中检查了这些步骤:
$ b


  1. 在您的repo中启用sparseCheckout: git config core.sparseCheckout true

  2. 为sparseCheckout添加路径 echo testSparseCheckout> .git / info / sparse-checkout

  3. 结帐至您想要的分行

这个场景适用于我的小测试git回购。


Is it possible to configure an existing local clone of a git repository for sparse checkout?

Existing discussion points to performing git init and git remote add -f origin <repo> which results in long download times for my situation.

I already have a repository locally and I just want to configure it for sparse checkout and then switch to a particular branch.

Thanks very much!

解决方案

You still can use this answer: https://stackoverflow.com/a/4909267/2253302

But you should skip some steps (i.e git init and git remote add -f origin <repo>). I check this steps for my test repo:

  1. Enable sparseCheckout in your repo: git config core.sparseCheckout true
  2. Add path for sparseCheckout echo testSparseCheckout > .git/info/sparse-checkout
  3. Checkout to your desired branch

This scenario works for me well on my small testing git repo.

这篇关于配置现有的git回购稀疏结帐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆