Git 为什么我的子模块拉原始代码而不是我的fork?
我正在建立vagrant+chef+magento,并找到了一个非常接近我需要的开源解决方案。我创建了一个使用子模块的存储库。我还分叉了一个子模块。我对这个子模块以及主回购协议进行了更改,并将其推回到每个子模块的分叉处。对我的主repo分支的一个更改是.gitmodules文件,以确保我的分支子模块将被我的分支主项目使用。这个链接有点不正确,因为每次都会拉原始子模块,而不是我的fork .gitmodulesGit 为什么我的子模块拉原始代码而不是我的fork?,git,github,repository,git-submodules,git-fork,Git,Github,Repository,Git Submodules,Git Fork,我正在建立vagrant+chef+magento,并找到了一个非常接近我需要的开源解决方案。我创建了一个使用子模块的存储库。我还分叉了一个子模块。我对这个子模块以及主回购协议进行了更改,并将其推回到每个子模块的分叉处。对我的主repo分支的一个更改是.gitmodules文件,以确保我的分支子模块将被我的分支主项目使用。这个链接有点不正确,因为每次都会拉原始子模块,而不是我的fork .gitmodules [submodule "recipes/cookbooks/vagrant_magen
[submodule "recipes/cookbooks/vagrant_magento"]
path = recipes/cookbooks/vagrant_magento
url = https://github.com/HexArmor/vagrant_magento
叉式回购
git子模块更新——init
仍然拉进了旧的子模块
任何帮助都将不胜感激,谢谢 看起来您从未将更改提交给超级项目中的子模块
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
安德鲁,显然我得等19个小时才能批准悬赏。谢谢你的回复。我会尽快批准。这解决了我所有的问题。我认为缺乏子模块的经验是我的问题。不用担心。子模块实际上远没有它们应有的可用性,而且几乎每个人在一开始就很难弄清楚它们。
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)$