4

Git 小抄

 2 years ago
source link: https://ourai.ws/notes/1fm9mt7i0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

子模块操作

初始化子模块

克隆项目后,默认子模块目录下无任何内容。需要在项目根目录执行如下命令完成子模块的下载:

git submodule init
git submodule update
git submodule update --init --recursive

删除子模块

  1. rm -rf 子模块目录 删除子模块目录及源码;
  2. vim .gitmodules 删除项目目录下 .gitmodules 文件中子模块相关条目;
  3. vim .git/config 删除配置项中子模块相关条目;
  4. rm -rf .git/module/子模块 删除模块下的子模块目录,每个子模块对应一个目录,注意只删除对应的子模块目录即可。

执行完成后,再执行添加子模块命令即可,如果仍然报错,执行 git rm --cached 子模块名称


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK