vault backup: 2022-06-08 15:35:30
Affected files: .obsidian/workspace 02. PARA/03. Resources(資源)/git/submodule.md attachments/Pasted image 20220608152709.png
This commit is contained in:
8
.obsidian/workspace
vendored
8
.obsidian/workspace
vendored
@@ -10,7 +10,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "02. PARA/03. Resources(資源)/C++17/智慧指標.md",
|
"file": "02. PARA/03. Resources(資源)/git/submodule.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"source": true
|
"source": true
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "02. PARA/03. Resources(資源)/C++17/智慧指標.md"
|
"file": "02. PARA/03. Resources(資源)/git/submodule.md"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "backlink",
|
"type": "backlink",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "02. PARA/03. Resources(資源)/C++17/智慧指標.md",
|
"file": "02. PARA/03. Resources(資源)/git/submodule.md",
|
||||||
"collapseAll": true,
|
"collapseAll": true,
|
||||||
"extraContext": true,
|
"extraContext": true,
|
||||||
"sortOrder": "alphabetical",
|
"sortOrder": "alphabetical",
|
||||||
@@ -125,8 +125,8 @@
|
|||||||
},
|
},
|
||||||
"active": "94f0e8a81af6c9e2",
|
"active": "94f0e8a81af6c9e2",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"02. PARA/03. Resources(資源)/C++17/智慧指標.md",
|
|
||||||
"02. PARA/03. Resources(資源)/git/submodule.md",
|
"02. PARA/03. Resources(資源)/git/submodule.md",
|
||||||
|
"02. PARA/03. Resources(資源)/C++17/智慧指標.md",
|
||||||
"02. PARA/03. Resources(資源)/git.md",
|
"02. PARA/03. Resources(資源)/git.md",
|
||||||
"02. PARA/03. Resources(資源)/C++17/rvalue.md",
|
"02. PARA/03. Resources(資源)/C++17/rvalue.md",
|
||||||
"02. PARA/03. Resources(資源)/C++17/lvalue.md",
|
"02. PARA/03. Resources(資源)/C++17/lvalue.md",
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
## 建立 Git Submodule
|
||||||
|
```
|
||||||
|
git submodule add <repository> [<path>]
|
||||||
|
```
|
||||||
|
新增之後,用 git status 會發現多了兩個東西需要 commit:
|
||||||
|
![[Pasted image 20220608152709.png]]
|
||||||
|
|
||||||
|
第一個檔案 .gitmodules,裡面紀錄 submodule 的對應關係,內容大概像這樣:
|
||||||
|
```
|
||||||
|
[submodule "RobotRunQA"]
|
||||||
|
path = RobotRunQA
|
||||||
|
url = git@github.com-logi:JuiwenHsu/RobotRunQA.git
|
||||||
|
```
|
||||||
|
|
||||||
|
接下來剩3個步驟:
|
||||||
|
1. 提交 `.gitmodule`:`git add .gitmodule ; git push origin master`
|
||||||
|
2. 跟git說我們有新增一個submodule:`git submodule init`
|
||||||
|
3. 把submodule pull下來:`git submodule update`
|
||||||
|
|
||||||
|
## Clone repository and submodule
|
||||||
|
當clone一個有submodule的repo的時候,我們還需要 `git submodule init` 跟 `git submodule update` ,例如:
|
||||||
|
```
|
||||||
|
git clone https://xxx/xxx.git
|
||||||
|
cd xxx
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
```
|
||||||
BIN
attachments/Pasted image 20220608152709.png
Normal file
BIN
attachments/Pasted image 20220608152709.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user