Where is the submodule fix number stored (and how to change it)?

To get a project with submodules, you run this command after cloning the project:

git submodule init

This command reads .gitmodulesand writes module information to the index.

Then you run

git submodule update

which gets a specific commit of the submodular repository.

How does git know which message in particular needs to be received? Where is this information stored?

The reason why I do not understand this is because I see that it is not .gitmodules, but I think that it is also unlikely to be in the index, since it git submodule initwrites it to the index. Therefore, he leaves this information not a logical place that I can think of.

, , ?

: this, this this. , , .

1

. , .

git checkout a18306f. , . :

git branch
## Note the current branch name, let assume it master, 
## use this branch name in the following command
git log -1 origin/master
## Now note the commit number. 
## This is where a18306f in the example above comes from in my use case. 
## And finally
git checkout a18306f

?

+4
1

git , , , ? ?

filestore git. , ansible , :

$ git submodule 
+ce6619bf5db87f94001625c991d02960109dee2d lib/ansible/modules/core (remotes/origin/stable-2.0.0.1)
+29af26884ea11639f38c145b348afccdb6923285 lib/ansible/modules/extras (remotes/origin/stable-2.0.0.1)

git cat-file . tree ...

$ git cat-file -p HEAD
tree a67c8a8e47ea232c9404cc1a971c6134c4008c65
parent 4b7b3794c9a3876080633eae2166a741a3330b27
author Toshio Kuratomi <toshio@fedoraproject.org> 1454618685 -0800
committer Toshio Kuratomi <toshio@fedoraproject.org> 1454618685 -0800

Fix --diff to respect no_log task parameter.

:

$ git cat-file -p a67c8a8e47ea232c9404cc1a971c6134c4008c65 | grep lib
040000 tree 68fa387f2e92cd18288b548a2007ac7ad4c43849    lib
$ git cat-file -p 68fa387f2e92cd18288b548a2007ac7ad4c43849 | grep ansible
040000 tree 6de49b0c156a5055575332e7fe527c9a5e6ca216    ansible
$ git cat-file -p 6de49b0c156a5055575332e7fe527c9a5e6ca216 | grep modules
040000 tree 94211515f23e286a634a7cdaab7958d286bd145f    modules
$ git cat-file -p 94211515f23e286a634a7cdaab7958d286bd145f
100644 blob ae8ccff5952585ebf8134e2f7d09dbfb63772976    __init__.py
160000 commit e1ec52e365a8fbe95c83db5da3046730c4dc39b2  core
160000 commit 14a62fb5d6771871654aedb4a36e17cf358785dc  extras

commit, .

, , ?

:

$ cd lib/ansible/modules/core

:

$ git checkout a18306f

, :

$ cd ..
$ git status
On branch devel
Your branch is up-to-date with 'origin/devel'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

  modified:   core (new commits)

:

$ git commit -m 'updated submodules to new commit' core
+6

Source: https://habr.com/ru/post/1627356/


All Articles