1

我正在设置 vagrant + chef + magento,并找到了一个非常接近我需要的开源解决方案。我分叉了一个使用子模块的存储库。我还分叉了其中一个子模块。我对这个子模块以及主 repo 进行了更改,并将它们推回了我的每个分支。对我的主 repo 的 fork 所做的更改之一是对 .gitmodules 文件的更改,以确保我的 fork 子模块将被我的 fork 主项目使用。这个链接在某种程度上是不正确的,因为每次都会拉出原始子模块而不是我的 fork。

.gitmodules

[submodule "recipes/cookbooks/vagrant_magento"]
    path = recipes/cookbooks/vagrant_magento
    url = https://github.com/HexArmor/vagrant_magento

分叉回购

调试的尝试

我使用这个 SO 答案以及这个 SO question作为我的故障排除指南。遵循每个答案中的各种答案都被证明是不成功的。

查看我的 fork git repo 的特定子模块部分 似乎证明我已经正确链接了这些。单击 vagrant_magento 或包含的参考标记都会使您进入我的子模块分支,这就是我想要在这里使用的。然而这个页面说它已经一年多没有更新了,这让我很困惑,拉下 repo 并且运行git submodule update --init仍然拉入旧的子模块。

任何帮助将不胜感激,谢谢!

4

1 回答 1

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)$ 
于 2014-10-28T14:25:50.007 回答