GIT使用笔记
# 添加子库
```
git submodule add ssh://d.d-l.io:29418/pcb/pcb-lib pcb-lib
git submodule add ssh://d.d-l.io:29418/pcb/pcb-script pcb-script
git submodule add ssh://d.d-l.io:29418/pcb/pcb-3d pcb-3d
git submodule update --init --recursive
```
# 删除子库
```
git rm pcb_library
git config -f .git/config --remove-section submodule.pcb_library
rm -rf .git/modules/pcb_library
```
# 直接抛弃历史, 起一个干净新分支
```
git checkout --orphan new-main
```
# 让所有子库和主库对齐
```
git submodule update --init --recursive
```
# 拉取全部子库
```
git pull --recurse-submodules
```
# 修改 .gitmodules 中的 URL
```
git config -f .gitmodules submodule.<子模块名>.url <新URL>
git submodule sync -- <子模块路径>
git add .gitmodules
git commit -m "chore: update submodule url to <新URL>"
```
评论
发表评论