git submodule的使用
来源:互联网 发布:软件授权方法 编辑:程序博客网 时间:2024/05/29 10:04
开发过程中,经常会有一些通用的部分希望抽取出来做成一个公共库来提供给别的工程来使用,而公共代码库的版本管理是个麻烦的事情。今天无意中发现了git的git submodule命令,之前的问题迎刃而解了。
添加
为当前工程添加submodule,命令如下:
git submodule add 仓库地址 路径
其中,仓库地址是指子模块仓库地址,路径指将子模块放置在当前工程下的路径。
注意:路径不能以 / 结尾(会造成修改不生效)、不能是现有工程已有的目录(不能順利 Clone)
命令执行完成,会在当前工程根路径下生成一个名为“.gitmodules”的文件,其中记录了子模块的信息。添加完成以后,再将子模块所在的文件夹添加到工程中即可。
删除
submodule的删除稍微麻烦点:首先,要在“.gitmodules”文件中删除相应配置信息。然后,执行“git rm –cached ”命令将子模块所在的文件从git中删除。
下载的工程带有submodule
当使用git clone下来的工程中带有submodule时,初始的时候,submodule的内容并不会自动下载下来的,此时,只需执行如下命令:
git submodule update --init --recursive
即可将子模块内容下载下来后工程才不会缺少相应的文件。
http://blog.csdn.net/wangjia55/article/details/24400501
0 0
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git submodule的使用
- git--submodule的使用
- git submodule的使用
- git submodule的使用
- 开启Linux之旅--Windows本机连接远程Linux主机
- CentOS 6.6 Minimal设置VirtualBox的共享文件夹
- Mat - 基本图像容器
- 编译、链接和加载
- weblogic获取客户端真实IP方法
- git submodule的使用
- RecyclerView实现Item滑动加载进入动画效果
- 21分钟 MySQL 入门教程
- 笔记-mysql 过程和触发器
- rman 恢复数据错误案例--ORA-19573 错误
- 参数传递多个SEL选择器
- maven创建spring项目之后,启动报错java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoade
- 让一个端口同时做两件事:http/https和ssh
- 【BZOJ2827】千山鸟飞绝 离散化+splay