我正在设置vagrant + chef + magento,并找到了一个非常接近我需要的开源解决方案。我分叉了一个使用子模块的存储库。我还分叉了一个子模块。我对这个子模块以及主要仓库进行了更改,并将其推回到每个子仓库。我的主回购分支的一个变化是.gitmodules文件,以确保我的分叉主模块将使用我的分叉子模块。这个链接在某种程度上是不正确的,因为原来的子模块每次都被拉出而不是我的叉子。
.gitmodules
[submodule "recipes/cookbooks/vagrant_magento"]
path = recipes/cookbooks/vagrant_magento
url = https://github.com/HexArmor/vagrant_magento
我使用了this SO answer以及this SO question作为我的问题排查指南。根据每个证明不成功的各种答案。
查看具体的submodule section of my fork's git repo 以证明我已正确关联这些内容。单击vagrant_magento或包含的引用标记都会将您置于我的子模块fork上,这就是我想要在这里使用的内容。然而,这个页面显示它在一年多的时间内没有更新,这让我感到困惑并且撤下了回购并且运行git submodule update --init
仍然会引入旧的子模块。
非常感谢任何帮助,谢谢!
答案 0 :(得分:1)
您似乎没有将更改提交到超级项目中的子模块。
me@myvm:/scratch/vagrant-magento-vm/recipes (master)$ git submodule status
6be892d5efb2050ed432ee1f71dab067343fcfd0 cookbooks/vagrant_magento (6be892d)
6be是你的更改后面的两个,并指向其中一个原始提交。
cd到子模块
me@myvm:/scratch/vagrant-magento-vm (master)$ cd recipes/cookbooks/vagrant_magento/
您指定新版本的准确程度取决于您。用于仅跟踪SHA的子模块,但最近它们也可以跟踪分支。
me@myvm:/scratch/vagrant-magento-vm/recipes/cookbooks/vagrant_magento ((6be892d...))$ git checkout master
Previous HEAD position was 6be892d... adds n98-magerun amazing shell script to installation
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
me@myvm:/scratch/vagrant-magento-vm/recipes/cookbooks/vagrant_magento (master)$ git log --oneline -3
b9be44a update version
489b6e4 changes to update to magento 1.9.0.0
6be892d adds n98-magerun amazing shell script to installation
现在回到超级项目并在那里注册更改
me@myvm:/scratch/vagrant-magento-vm/recipes/cookbooks (master)$ cd ../../
me@myvm:/scratch/vagrant-magento-vm (master)$ 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)
modified: recipes/cookbooks/vagrant_magento (new commits)
Submodules changed but not updated:
* recipes/cookbooks/vagrant_magento 6be892d...b9be44a (2):
> update version
no changes added to commit (use "git add" and/or "git commit -a")
me@myvm:/scratch/vagrant-magento-vm (master)$ git add recipes/cookbooks/vagrant_magento
和最终结果
me@myvm:/scratch/vagrant-magento-vm (master)$ git commit -m "update submodule"
[master 57be259] update submodule
1 file changed, 1 insertion(+), 1 deletion(-)
me@myvm:/scratch/vagrant-magento-vm (master)$ git submodule status
fca9af50217493f120706871719f5f88ad0c6082 recipes/cookbooks/apache2 (1.6.2-5-gfca9af5)
ea834265247cc8b507ac37ab3a34a9b44ed27a11 recipes/cookbooks/apt (1.7.0)
df4264aad07d706f3207cb1fe2bbfa03a0b82f31 recipes/cookbooks/build-essential (1.4.0-2-gdf4264a)
a702e254833cac60b3f1fbc3ae098850b40572d7 recipes/cookbooks/chef_handler (1.1.4)
8f31c451d1b090165c758d37b2d4a78a533ccf31 recipes/cookbooks/database (1.4.0-1-g8f31c45)
5860dd00c470f1bdebf42bf369d9da58029ce9f5 recipes/cookbooks/git (2.5.2-1-g5860dd0)
164962228fb3f1f7b95469305347a982e958806d recipes/cookbooks/memcached (1.4.0-1-g1649622)
61bda92b46f2eabd59a8e4c3eef4df8096bcf0dc recipes/cookbooks/mysql (3.0.0-10-g61bda92)
ccf81e9b3fec9427ed2e6dd76f252dcf68370379 recipes/cookbooks/openssl (1.0.2)
6a3056dae96d0a826ddc8f5a8ff392afa61aaafc recipes/cookbooks/php (1.2.0-8-g6a3056d)
124e59194a1fca4563ed1a8dfd517808864a6b90 recipes/cookbooks/runit (1.1.4)
b9be44ad2eba72680980e8846da79c882e50c44c recipes/cookbooks/vagrant_magento (heads/master)
88e8d018267d2cd5cfa3260ce55a0025f52dae6f recipes/cookbooks/vim (v1.1.0~3)
d8b8bf88faf1c07c51d033a9517f04687128e530 recipes/cookbooks/windows (1.9.0-1-gd8b8bf8)
me@myvm:/scratch/vagrant-magento-vm (master)$