1. 子模块

子模块允许你将一个 Git 仓库作为另一个 Git 仓库的子目录。 它能让你将另一个仓库克隆到自己的项目中,同时还保持提交的独立

1.1. 添加子模块

$ git submodule add --name DbConnector https://github.com/chaconinc/DbConnector DbConnector

1.2. 克隆含有子模块的项目

1.2.1. 方法一

$ git clone https://github.com/chaconinc/MainProject
$ cd MainProject
$ git submodule init
$ git submodule update

1.2.2. 方法二

$ git clone --recursive https://github.com/chaconinc/MainProject

1.3. 更新子模块

$ git submodule update --remote

1.4. 删除子模块

git submodule deinit -f -- a/submodule    
rm -rf .git/modules/a/submodule

git rm -rf a/submodule
# Note: a/submodule (no trailing slash)

# or, if you want to leave it in your working tree
git rm --cached a/submodule
git submodule add --name RSKImageCropper https://github.com/shimo-react-native/RSKImageCropper.git ios/RSKImageCropper

git submodule deinit -f -- ios/RSKImageCropper
rm -rf .git/modules/ios/RSKImageCropper
git rm -rf ios/RSKImageCropper
git rm --cached ios/RSKImageCropper

results matching ""

    No results matching ""