0

I have searched and can't find a direct answer to this question specifically.

  • I don't want to use any of the submodule commands to update my submodule
  • I don't want to use googles repo or another tool to accomplish this.

Also, is there good reason if the answer is no? Or is this just an unfortunate design?

EDIT: Title for clarity

Additional Info: I'm familiar with the fact that submodules use a gitlink and information located in .gitmodules as well as .git/config.

I should have been more clear that I'd like to know more regarding the design intent of this.

Grit
  • 9
  • 2
  • 2
    Why don't you want to use the command that's the command for doing the thing that you want to do? – jonrsharpe Nov 29 '18 at 22:10
  • Specifying which commit the sub-module should be in .gitmodules feels much more intuitive to me and would allow for a single source of truth. If I want to change the commit the submodule points to just adjust it in .gitmodules and track like any other change would. – Grit Nov 30 '18 at 17:07
  • No, the commit is a gitlink: a special entry in the index. Search for "special mode" in https://git-scm.com/book/en/v2/Git-Tools-Submodules. See https://stackoverflow.com/a/16581096/6309 for illustration. – VonC Nov 30 '18 at 17:15
  • My question should be written more clearly. I am familiar with the mechanics at a basic level of submodules but I'm looking for someone to answer with a yes or no and give some background as to why a special mode folder (gitlink) is used instead of simply tracking an entry in .gitmodules. – Grit Nov 30 '18 at 17:21

1 Answers1

0

Updating a submodule won't change anything: it only refers to the remote URL, not the SHA1.

You should be able to update a submodule by going in it, do a git pull (assuming it follows a branch), then go to the parent repo, add, commit and push.

The first part is what git submodule update --remote does.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I more or less know the answer to the first part of my question. I just don't understand why .gitmodules wouldn't be similar to .gitignore whose changes are tracked like any other file. – Grit Nov 30 '18 at 17:17
  • @Grit Because the data (a tree SHA1) has nothing to do with a file, and everything to do with the index managed by Git. – VonC Nov 30 '18 at 17:41