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