Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_submodules [2019/02/27 14:33] – [The end result] rpjday | git_submodules [2019/02/27 19:14] (current) – [Overview] rpjday | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| The good and the bad of submodules, using Wind River' | The good and the bad of submodules, using Wind River' | ||
| + | |||
| + | Stuff to add: | ||
| + | |||
| + | * '' | ||
| ===== Links ===== | ===== Links ===== | ||
| Line 331: | Line 335: | ||
| </ | </ | ||
| - | ==== The end result | + | Note that this has //not// committed the new submodule yet. So what //has// it done? |
| + | |||
| + | ==== The situation thus far ==== | ||
| < | < | ||
| Line 353: | Line 359: | ||
| </ | </ | ||
| - | + | The new '' | |
| - | + | ||
| - | ==== Adding a submodule -- what just happened? ==== | + | |
| - | + | ||
| - | === The new .gitmodules file === | + | |
| - | + | ||
| - | The new '' | + | |
| < | < | ||
| + | $ cat .gitmodules | ||
| [submodule " | [submodule " | ||
| path = coroutine2 | path = coroutine2 | ||
| Line 367: | Line 368: | ||
| </ | </ | ||
| - | === git diff === | + | The content of the new submodule working tree: |
| - | There is no current '' | + | < |
| + | $ tree coroutine2/ | ||
| + | coroutine2/ | ||
| + | ├── doc | ||
| + | │ ├── acknowledgements.qbk | ||
| + | │ ├── architectures.qbk | ||
| + | │ ├── asymmetric.qbk | ||
| + | │ ├── coro.qbk | ||
| + | │ ├── coroutine.qbk | ||
| + | │ ├── images | ||
| + | │ │ ├── event_model.dia | ||
| + | │ │ ├── event_model.png | ||
| + | ... etc etc ... | ||
| + | </ | ||
| + | |||
| + | The content of the new submodule's Git directory: | ||
| < | < | ||
| - | $ git diff | + | $ ls -lF .git/ |
| + | total 48 | ||
| + | drwxrwxr-x. 2 rpjday rpjday 4096 Feb 27 09:31 branches/ | ||
| + | -rw-rw-r--. 1 rpjday rpjday | ||
| + | -rw-rw-r--. 1 rpjday rpjday | ||
| + | -rw-rw-r--. 1 rpjday rpjday | ||
| + | drwxrwxr-x. 2 rpjday rpjday 4096 Feb 27 09:31 hooks/ | ||
| + | -rw-rw-r--. 1 rpjday rpjday 7299 Feb 27 09:33 index | ||
| + | drwxrwxr-x. 2 rpjday rpjday 4096 Feb 27 09:31 info/ | ||
| + | drwxrwxr-x. 3 rpjday rpjday 4096 Feb 27 09:31 logs/ | ||
| + | drwxrwxr-x. 4 rpjday rpjday 4096 Feb 27 09:31 objects/ | ||
| + | -rw-rw-r--. 1 rpjday rpjday 1161 Feb 27 09:31 packed-refs | ||
| + | drwxrwxr-x. 5 rpjday rpjday 4096 Feb 27 09:31 refs/ | ||
| $ | $ | ||
| </ | </ | ||
| - | but examine what's been staged: | + | ==== Running "git diff" ==== |
| < | < | ||
| - | $ git diff --staged | + | $ git diff --cached |
| diff --git a/ | diff --git a/ | ||
| new file mode 100644 | new file mode 100644 | ||
| Line 391: | Line 419: | ||
| diff --git a/ | diff --git a/ | ||
| new file mode 160000 | new file mode 160000 | ||
| - | index 0000000..fc3cb67 | + | index 0000000..0233d35 |
| --- /dev/null | --- /dev/null | ||
| +++ b/ | +++ b/ | ||
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| - | +Subproject commit | + | +Subproject commit |
| $ | $ | ||
| </ | </ | ||
| - | You can also use the '' | + | Abbreviated form: |
| < | < | ||
| Line 412: | Line 440: | ||
| + path = coroutine2 | + path = coroutine2 | ||
| + url = https:// | + url = https:// | ||
| - | Submodule coroutine2 0000000...fc3cb67 | + | Submodule coroutine2 0000000...0233d35 |
| $ | $ | ||
| </ | </ | ||
| Line 419: | Line 447: | ||
| < | < | ||
| - | $ git commit -am "added coroutine2 submodule" | + | $ git commit -a -m "added coroutine2 submodule" |
| - | [master | + | [master |
| 2 files changed, 4 insertions(+) | 2 files changed, 4 insertions(+) | ||
| | | ||
| - | | + | |
| $ | $ | ||
| </ | </ | ||
| Line 431: | Line 459: | ||
| < | < | ||
| $ git push origin master | $ git push origin master | ||
| - | </ | ||
| - | |||
| - | ===== Under the hood ===== | ||
| - | |||
| - | The submodule directory has a //file// named '' | ||
| - | |||
| - | < | ||
| - | $ cat coroutine2/ | ||
| - | gitdir: ../ | ||
| - | $ | ||
| - | </ | ||
| - | |||
| - | From the superproject, | ||
| - | |||
| - | < | ||
| - | $ ls -l .git/ | ||
| - | total 48 | ||
| - | drwxrwxr-x. 2 rpjday rpjday 4096 Feb 13 15:37 branches | ||
| - | -rw-rw-r--. 1 rpjday rpjday | ||
| - | -rw-rw-r--. 1 rpjday rpjday | ||
| - | -rw-rw-r--. 1 rpjday rpjday | ||
| - | drwxrwxr-x. 2 rpjday rpjday 4096 Feb 13 15:37 hooks | ||
| - | -rw-rw-r--. 1 rpjday rpjday 7299 Feb 13 15:38 index | ||
| - | drwxrwxr-x. 2 rpjday rpjday 4096 Feb 13 15:37 info | ||
| - | drwxrwxr-x. 3 rpjday rpjday 4096 Feb 13 15:37 logs | ||
| - | drwxrwxr-x. 4 rpjday rpjday 4096 Feb 13 15:37 objects | ||
| - | -rw-rw-r--. 1 rpjday rpjday 1174 Feb 13 15:37 packed-refs | ||
| - | drwxrwxr-x. 5 rpjday rpjday 4096 Feb 13 15:37 refs | ||
| - | $ | ||
| - | </ | ||
| - | |||
| - | ===== Cloning a project with submodules ===== | ||
| - | |||
| - | If you don't want to populate the submodule directories: | ||
| - | |||
| - | < | ||
| - | $ git clone https:// | ||
| - | </ | ||
| - | |||
| - | If you want to populate the submodule diredctories: | ||
| - | |||
| - | < | ||
| - | $ git clone --recurse-submodules https:// | ||
| - | </ | ||
| - | |||
| - | Populate all submodules after the fact: | ||
| - | |||
| - | < | ||
| - | $ git submodule update --init --recursive | ||
| </ | </ | ||