Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>Yes, as explained in "<a href="https://stackoverflow.com/a/1979194/6309">true nature of submodules</a>"</p></li> <li><p>a git submodule is a reference to a specific commit (SHA1), not a branch, so you are always in a detach mode a first (which is compatible with a read-only usage).<br> In other words, <code>git submodule update</code> checks out a specific commit, rather than the tip of a branch.<br> The <code>.gitmodule</code> file will contain the reference of your submodule repo. And the specific SHA1 will be recorded in the parent repo as a special commit (mode 160000). When you '<code>git submodule add</code>' a new submodule, it records the SHA1 at which that other repo is currently checked out (whatever its branch).<br> If you want to make changes, then you must checkout a branch within that submodule repo (an existing branch <em>or a new one</em>: in both cases, you will push any new change back to the remote repo of that submodule).<br> An alternative would be <a href="http://gitslave.sourceforge.net/" rel="nofollow noreferrer">git slave</a>.</p></li> <li><p>See 2. The other branch(es) listed in the <code>git branch</code> are the local one existing in your submodule repo, including one local branch for each <a href="https://stackoverflow.com/a/4697054/6309">tracking branch</a> if you did a <code>git pull</code> at one point. </p></li> <li><p>Because the parent still reference the initial SHA1 of the submodule.<br> But since you have made modifications in it, that SHA1 needs to be updated.<br> Keep in mind that the submodule is a git repo in itself... with absolutely no idea it is used as a submodule. Hence the necessity to record the new state of that repo in the parent repo (the only one keeping track of the state of its submodules).<br> Your first git push is entirely an <em>internal</em> operation of the submodule repo (which isn't seen at all by the parent repo).<br> For a parent repo, the submodule repo is a "black box", with only a remote address and a SHA1. Whatever is done within the submodule has no consequence on the parent, which will detect only the change of the SHA1 of the submodule tree. </p></li> <li><p>Using <a href="http://help.github.com/fork-a-repo/" rel="nofollow noreferrer">forks</a> might help<br> See "<a href="https://stackoverflow.com/a/914090/6309">Changing remote repository for a git submodule</a>" to update your submodule remote URL.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload