2
我想知道,如果这是去工作......Git的 - 从模板项目合并 - 没有子目录
说我有一个项目模板类似的东西:
.
+ resources/
+ images/
1.png
2.png
我想使用这个项目作为其他项目的模板,所以它们将基本上从模板“克隆”,但作为单独的存储库维护。
但是,我仍然希望能够在模板出现时从模板中提取更新(但不必考虑推送到它)。
子模块或子树合并似乎不适合在这里,因为它不克隆到子目录;它被有效地“映射”到根目录或新项目。
一一我认为可以工作,将是这样的:
#setup project
mkdir proj1
cd proj1
git init.
touch .gitignore
git add .gitignore
git commit -m "Initial Commit"
#setup main repo
git remote add origin [email protected]:proj1.git
git push origin master
# load template repo as separate remote
git remote add -f template [email protected]:template.git
# import into current master
# here I guess I have the choice of either:
git merge template/master
# OR
git rebase template/master
再后来在模板更新项目:
.
+ resources/
+ images/
1.png
2.png
3.png <-added file
我应该能够做git pull template master
从模板中提取更改并重复上次合并/重新分级步骤以集成到项目中。
这是正确的方法,还是有更好的方法来做到这一点?
我会遇到一些麻烦,这沿着轨道?
感谢
所以你说的是做我在问题中提出的建议..? (appart来自rebase) – Ben 2012-02-02 02:52:45
小资多。我不确定还会有什么帮助。也许结帐rerere? – 2012-02-02 08:42:26