Previous Post | Top | Next Post |
TOC
The git submodule update --init
is nice. I checked how all these repos are managed.
If I want to move submodule, I don’t need delete and clone again. I can simply move it with “git mv <oldpath> <newpath>
” while we keep using the same local copy of repo.
Let’s see how this is done.
<modulename>/.gitmodules
This file is checked in to the parent Git repository and contains:
[submodule "pack/github/opt/ale"]
path = pack/ale
url = https://github.com/dense-analysis/ale.git
submodule
-line is where local bare cloned repo exists. For this case,<modulename>/.git/modules/pack/github/opt/ale
– PATH_BAREpath
-line is where the submodule are checked out. – PATH_CHECKOUTurl
-line is where remote repo is. – URL
The checked out repo can be moved by git mv
.
<modulename>/pack/ale/.git
This is created by git submodule
in the submodule directory and has gitdir: ../../.git/modules/pack/github/opt/ale
in it pointing to where local bare cloned repo exists. – PATH_BARE
<modulename>/.git/submodule/pack/github/opt/ale/config
This is deep in the subdirectory of the parent Git repository’s .git
directory where the bare clone of submodule repository exists.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
worktree = ../../../../../../pack/ale
[remote "origin"]
url = https://github.com/dense-analysis/ale.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
worktree
-line s where the submodule are checked out. – PATH_CHECKOUTurl
-line is where remote repo is. – URL
<modulename>/.git/config
This is in the parent Git repository’s .git
and its main configuration. For submodule, this has:
[submodule "pack/github/opt/ale"]
active = true
url = https://github.com/dense-analysis/ale.git
submodule
-line is where local bare cloned repo exists. For this case,<modulename>/.git/modules/pack/github/opt/ale
. – PATH_BAREurl
-line is where remote repo is. – URL
Previous Post | Top | Next Post |