diff --git a/use.md b/use.md index 19c28aa..05d37fd 100644 --- a/use.md +++ b/use.md @@ -1,10 +1,49 @@ +# RuoYi-Cloud 代码拉取说明 + +## 首次克隆代码 +```bash git clone --recurse-submodules http://th.local.t-aaron.com:13000/THENG/a-cloud-all.git cd a-cloud-all +``` -日常更新代码: -# 更新主仓库和所有子模块 -git pull --recurse-submodules +## 日常更新代码(推荐) +```bash +# 更新主仓库和所有子模块到主仓库记录的版本 +git pull && git submodule update --init --recursive +``` -# 或者分步执行 +## 其他更新方式 + +### 方式1:更新子模块到各自远程的最新版本 +```bash git pull -git submodule update --init --recursive \ No newline at end of file +git submodule update --remote --recursive +``` + +### 方式2:创建别名简化操作 +```bash +# 配置别名(只需执行一次) +git config alias.pullall '!git pull && git submodule update --init --recursive' + +# 之后使用别名更新 +git pullall +``` + +## 常用子模块命令 +```bash +# 查看子模块状态 +git submodule status + +# 在所有子模块中执行命令 +git submodule foreach 'git status' +git submodule foreach 'git pull origin main' + +# 更新特定子模块 +git submodule update --remote ruoyi-gateway +``` + +## 注意事项 +- `git pull --recurse-submodules` 只会拉取主仓库,不会自动更新子模块代码 +- 必须执行 `git submodule update` 才会真正拉取子模块的代码 +- `--init` 参数会初始化还未初始化的子模块 +- `--recursive` 参数会递归更新所有嵌套的子模块 \ No newline at end of file