1

I'm looking at someone elses repo. Inside it there is a folder which I beleive to be a referenced sub module. It's name is like this:

website @ 5afa940

There is a file called .gitmodules with this content:

[submodule "website"]
    path = website
    url = git@github.com:xyz/website.git
    branch = master

If the .gitmodule is refencing the master branch why in github can I still see a folder reference with a different tree reference than master?

Is there anyway I can adjust this from github online or do I need to use git command line?

Jimmy
  • 12,087
  • 28
  • 102
  • 192

1 Answers1

1

If the .gitmodule is refencing the master branch why in GitHub can I still see a folder reference with a different tree reference than master?

Because a submodule always reference a SHA1

The "master" branch specification is there only if you are using

git submodule update --remote

See "Git submodules: Specify a branch/tag" and "git submodule tracking latest" for more.

Once you have clone and updated (--remote) locally, then the SHA1 recorded by the gitlink (special entry in the index) will be changed (to the latest fetched SHA1 of origin/master for the submodule upstream repo).
You will then be able to git add and git push that new reference back to GitHub.

Only then will GitHub display an updated SHA1.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Ok, thank you very much for the comment. Is it not possible in this regard for my main repo to always reference the latest version of website without having to go through the process of updating the SHA1 each time? – Jimmy Feb 11 '15 at 11:53
  • @Jimmy yes, you need to go through that process in order to update the SHA1 referenced by a submodule. – VonC Feb 11 '15 at 12:09