所以我最近做了:
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$
但是你可以看到它不会提交它们,因为显然没有变化?我不明白这一点。 这里到底发生了什么?
答案 0 :(得分:0)
这是因为更改是在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 command