You can declare d:\temp1
as:
See "true nature of submodules":
temp1
would become a subfolder of d:\repositories\temp
,
- any change made in
d:\temp1
can be committed, and updated in d:\repositories\temp\temp1
after a git submodule update --remote
That way, at any point, temp
records the exact state of temp1
it is working with (I prefer that to a subtree)
As I mentioned in "SVN:externals equivalent in GIT?", this is close to svn:external
, even though it is not completely the same.
Note that if you push temp
to GitHub, you will see temp1
as a gray folder: That gray folder is a gitlink (a special entry in the parent index)
If you clone that GitHub repo with the --recursive option, you will get back the content of temp1
, because Git will be able to clone back /d/temp1
.
...
However, nobody else would be able to clone your GitHub repo and get that temp1
content, since they don't have access to your /d
disk!
In order to preserve the content of a submodule, it is best if temp1
itself is first pushed to its own GitHub repo, and temp
reference temp1
through its GitHub url (and not through a local path /d/temp1
).
See here to change the url of submodule temp1
.