所以我最近做了:
git submodule foreach git submodule foreach git pull origin master我得到了一个巨大的输出,因为它拉和更新这些子模块的最新和最伟大的。然后我做了:
vagrant@vagrantpress:/vagrant/Freya-Vagrant$ 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 checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: local-dev/content/mu-plugins/Freya-MU (modified content)
modified: local-dev/content/themes/freya-theme (modified content)
no changes added to commit (use "git add" and/or "git commit -a")
vagrant@vagrantpress:/vagrant/Freya-Vagrant$ git commit -a
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: local-dev/content/mu-plugins/Freya-MU (modified content)
modified: local-dev/content/themes/freya-theme (modified content)
no changes added to commit
vagrant@vagrantpress:/vagrant/Freya-Vagrant$ git add -A
vagrant@vagrantpress:/vagrant/Freya-Vagrant$ git commit -a
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: local-dev/content/mu-plugins/Freya-MU (modified content)
modified: local-dev/content/themes/freya-theme (modified content)
no changes added to commit
vagrant@vagrantpress:/vagrant/Freya-Vagrant$但正如你所看到的,它不会提交,因为显然没有变化?我不明白这个。,到底怎么回事?
发布于 2015-07-17 06:42:34
这是因为更改在git子模块项目中,而不是根项目中。
在https://git-scm.com/book/en/v2/Git-Tools-Submodules的文档之后,您可能希望执行如下操作:
cd local-dev/content/mu-plugins/Freya-MU
git checkout master # or some other branch
git submodule update --remote --merge
# make edits, e.g.:
vi README.md
git commit -m "test" README.md
git submodule update --remote --rebase
git push --recurse-submodules=check # follow the output from this commandhttps://stackoverflow.com/questions/31464122
复制相似问题