http://schacon.github.io/git/git-read-tree.html#_sparse_checkout

Existing Repository

If you already have a repository, simply enable and configure sparse-checkout as above and do git read-tree.

  1. Enable sparse-checkout:

    git config core.sparsecheckout true
  2. Configure sparse-checkout by listing your desired sub-trees in .git/info/sparse-checkout:

    echo some/dir/ >> .git/info/sparse-checkout
    echo another/sub/tree >> .git/info/sparse-checkout
  3. Update your working tree:

    git read-tree -mu HEAD

可以略过第二步

1.   git config core.sparsecheckout true

2   Update your working tree:

git read-tree -mu HEAD

3

git checkout [branch] -- fileName

Git单独checkout子目录的更多相关文章

  1. git branch & checkout fetch 的使用和冲突解决

    git branch & checkout fetch 的使用和冲突解决 branch git branch 查看本地分支 git branch -v    查看本地分支的具体信息(commi ...

  2. Git的checkout, reset, revert

    不管是修改还是新建文件,都必须通过git add把这次修改从工作区加到暂存区: commit只是提交暂存区的修改,还没add到暂存区处于工作区的修改是不会commit的:   git checkout ...

  3. 在 Git 中 Checkout 历史版本

    昨天写代码的时候,误删了一个文件.今天发现的时候,commit 已经 push 到版本库了.本想用 git reset 回退版本,找回文件后重新提交.但是想起 Git 是一个版本控制系统哎,直接从版本 ...

  4. Git CMD - checkout: Switch branches or restore working tree files

    命令格式 git checkout [-q] [-f] [-m] [<branch>] git checkout [-q] [-f] [-m] --detach [<branch&g ...

  5. Git sparse checkout

    Git的sparse checkout在clone项目仓库时只clone指定路径下的信息. 步骤如下: (1) mkdir yourdir(2) cd yourdir(3) git init(4) g ...

  6. git使用中checkout生成临时br的问题(吓出一身冷汗啊)

    git中几天前漫不经心的使用了git checkout ver_hash的命令,结果push到远程库都提示everything is up-to-date,实际神马都没提交上去啊!但看本地log中的确 ...

  7. git 命令 —— checkout

    git checkout 会重写工作区.check in 常常表示酒店入住,则 check out 就表示结账(检查)离开. 1. 基本用法 Git学习笔记04–git checkout git ch ...

  8. 【Git】原Git库拆分子目录作为新仓库,并保留log记录

    一.需求描述: 现有一个git仓库,Team A和Team B的人操作同一仓库的不同目录,Team A的dev希望Team B的dev没有权限review属于Team A的代码目录,故现需要先将这个g ...

  9. [Git] 011 checkout 与 reset 命令的补充

    1. git checkout -- <file> 的示意 2. "checkout" 的补充 2.1 git checkout <branch_name> ...

随机推荐

  1. Nginx redirect

    if ($host != 'www.xxxxx.com' ) { rewrite ^/(.*)$ http://www.xxxx.com/$1 permanent; }

  2. lsof使用

    用netstat命令去统计服务器目前的网络连接状态 netstat -n|awk '/^tcp/{++S[$NF]}END{for(a in S) print a,S[a]}'   netstat - ...

  3. ubuntu 设置静态IP之后不能上网。

    一个同事设置之后不能上网. 根据经验DNS有问题. 所以就设置8.8.8.8 之后就好了 DONE

  4. uinavigationcontroller uinavigationbar 下方横线去除

    #import "QKBaseNavigationController.h" #define fontSize 19 @interface QKBaseNavigationCont ...

  5. hadoop 常用配置项【转】

    hadoop 常用配置项[转] core-site.xml  name value  Description   fs.default.name hdfs://hadoopmaster:9000 定义 ...

  6. HP Autonomy KeyView入门使用&Maven打包流程

    正文:使用自带的KeyView.jar可能报各种各样的错误,比如no manifest,找不到main方法等等,这里需要自己把需要用到的Filter类和KeyView.jar一起打包,并修改manif ...

  7. js格式转换

    //1.保留整数 function showInteger(value,row,index){ if(value!=null && value!="" && ...

  8. Sass编译Css

    1.我新建了一个项目工程 2.路径在 3.编译 sass 要编译的sass文件名.scss ../存放编译后的css目录/编译后的css名称.css 4.刷新项目,就编译出来了 6.当然,你要嫌麻烦的 ...

  9. 《JS权威指南学习总结--8.6 函数闭包》

    内容要点: 和其他大多数现代编程一样,JS也采用词法作用域,也就是说,函数的执行依赖于变量作用域,这个作用域是在函数定义时决定的,而不是函数调用时决定的. 为了实现这种词法作用域,JS函数对象的内部状 ...

  10. 《JS权威指南学习总结--8.5 作为命名空间的函数》

    内容要点:    函数作用域的概念:在函数中声明的变量在整个函数体内都是可见的(包括在嵌套的函数中),在函数的外部是不可见的.不在任何函数内声明的变量是全局变量,在整个JS程序中都是可见的. 在JS中 ...