git子模块推送过程中发生的情况



我可以本地提取子模块(subby(的最新提交,答案如下:

$ git clone --recurse-submodules <omitted>/importer.git
$ cd importer
$ cat subby/README.md
cat: subby/README.md: No such file or directory
#
# good ! it's not supposed to exist
#
$ git submodule foreach git pull origin master
Entering 'subby'
<omitted>
Fast-forward
README.md | 1 +
1 file changed, 1 insertion(+)
create mode 100644 README.md
$ cat subby/README.md 
Hello oren
#
# good ! now it exists
#

但现在我想推动改变

$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified:   subby (new commits)
no changes added to commit (use "git add" and/or "git commit -a")

闭上眼睛,希望最好的工作与:

$ git add subby
$ git commit -m "updating subby"
$ git push

但我到底犯了什么罪?子文件夹?

您提交了一个gitlink(如此处所示(,这是索引中的一个特殊条目(此处记录(,表示子模块根SHA1。

这样,git clone --recurse-submodules就知道哪个子模块的提交到签出。

相关内容

最新更新