Update all the submodule files
Use Git Submodule to manage your file version: Update all the submodule files
If you create a KJModule
repository for a submodule on the github, please make sure to commit once
to let the whole repository is able to add it to another repository as a submodule
git@github.com:kejyun/KJModule.git
git submodule add <repository> [<path>]
git submodule add git@github.com:kejyun/KJModule.git ./app/KJModule
You have to specify the submodule repository
and the submodule path
git clone git@github.com:kejyun/KJ.git
git submodule init
git submodule update
If you want to delete or update the submodule, then you have to update the .gitmodules
files on the root path.
[submodule "app/KeJyunModule"]
path = app/KeJyunModule
url = git@github.com:kejyun/KeJyunModule.git
[submodule "app/KeJyunGroupModule"]
path = app/KeJyunGroupModule
url = git@github.com:kejyun/KeJyunGroupModule.git
You can find you submodule files in the hidden folder .git
.git/modules/<模組路徑>/config
vim ~/KeJyunProject/.git/modules/app/KeJyunModule/config
Update url
from the [remote"origin"]
on the config
file to update the submodule path
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
worktree = ../../../../app/KeJyunModule
[remote "origin"]
url = git@github.com:kejyun/KeJyunModule.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
You can add --recursive
argument to fetch all of the files and submodule on the repository
git clone --recursive git@github.com:kejyun/KJ.git
You can use submodule to manage different project file on git. But the subodule might include another submodule
. So you can run the following command to fetch all the files from submodule’s submodule.
git submodule update --init --recursive
Because the submodule might have its own submodule. So the submodule might cause the recursive
submodule problem to the infinite loop
from fetching all the submodule files.
So the better way is to make a rule to include submodule to prevent the recursive
submodule problem.
- Complicate Repositoy
- Independent Component Repository Submodule
- Independent Helper Method Repositoy Submodule
Use Git Submodule to manage your file version: Update all the submodule files
Use Git Submodule to manage your file version: Delete Submodule