【发布时间】:2012-03-13 18:14:06
【问题描述】:
所以我几天前开始使用 Git。 (晚会很晚 - 不要责骂 :))。真正开始熟悉基本的命令、想法和工作流程。然而,子模块真的让我大吃一惊。我正在尝试为FuelPHP 的GitHub 贡献代码,我可以使用一些指导和技巧。
我正在终端中运行以下命令:
//1: clone the repository from Fuel's github.
git clone git://github.com/fuel/fuel.git
//2: move into the main fuel directory
cd fuel
//3: initilize the submodules (populate .git/config with submodule data)
git submodule init
//4: download the submodules...
git submodule update
//5: move into the core directory (which is a submodule).
cd fuel/core
//6: change branch from (*no branch) to 1.1/develop
git checkout 1.1/develop
//7: open random file in text editor + make some small change (i.e. typo) + save file.
sudo gedit classes/autoloader.php
//8: add this file to the staging area.
git add classes/autoloader.php
//9: commit this file under 1.1develop branch.
git commit -m "im committing a submodule"
//10: push the new commit to MY (not fuel's) github repo (yes i've renamed the repo).
git push git@github.com:jordanarseno/fuel-core.git
//11: changes are reflected on github, looks good.
//12: back way out to fuel again. time to push the submodule commit separately.
cd ../../
//13: add the fuel/core submodule to the staging area.
git add fuel/core
//14: commit the submodule change.
git commit -m "submodule pushed. pushing super now."
//15: push the commit to MY (not fuel's) github repo.
git push git@github.com:jordanarseno/fuel.git
具体来说,我的问题是:
- 这是处理子模块的正确工作流程吗?你会这样做吗?
- 为什么 git 拉下子模块中的
1.1/develop分支,但默认设置为*no branch?我可以修改这种行为吗? - Fuel 子模块的哪一部分告诉 git 从拉 1.1/develop 开始? 还有其他分支(
1.1/master、1.0/develop等)。 - 为什么我们不能在第 11 步收工?子模块推送工作正常。之后我推超级因为手册tells me it's a good idea。事实上,前往 GitHub 并查看 MY super,提交了一个。 This commit 845de87 然而,似乎只是参考 Fuel 的超级而不是我的超级。它不应该链接到我的仓库而不是他们的吗?
- 在超级节目中运行
cat .git/config:
连同所有的子模块...
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git://github.com/fuel/fuel.git`
在核心子模块中运行cat .git config显示:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git://github.com/fuel/core.git
将这些 url 更改为我自己在 GitHub 上的 repo 是否明智?无论如何,燃料否认推动。如果我执行子模块更新,它们会被覆盖吗?
我也在 Fuel's Forums 上问过这个问题,但这是一个更笼统的问题,这里有更多的 Gitters...谢谢!
【问题讨论】: