notebook/IT/Git/Submodule.md

33 lines
923 B
Markdown
Raw Permalink Normal View History

2021-02-17 19:26:59 +00:00
# submodule
Git submodule allows ro add externel repository in a repository
## Adding submodule
- ```git submodule add http://git/toto.git $path```
2021-04-20 21:13:14 +00:00
this command add *<http://git/toto.git>* in *path* directory (add -b $branchname to follow specific branch)
2021-02-17 19:26:59 +00:00
- after that you need to add and commit submodule folder
to populate a submodule nested in other submodule
- ```git submodule init```
- ```git submodule update```
## removing submodule
- remove submodule entry in *.gitmodules*
- remove submodule entry in *.git/config* (only present when **git submodule init** have been perform)
- remove submodule path ```git rm --cached $path```
## Updating submodule
you can update a submodule Manually going in submodule folder and perform a ```git fetch``` and ```git merge```
### Fetch and merge
2021-04-20 21:13:14 +00:00
2021-02-17 19:26:59 +00:00
automatic process
2021-04-20 21:13:14 +00:00
- perform a ```git submodule update --remote```
2021-02-17 19:26:59 +00:00
in each case you need to commit update in project