2012-12-13 100 views
1

我創建了一個項目(https://github.com/twaldecker/vim-cheat-sheet),現在我意識到我喜歡這個cheatsheet的風格並希望創建一個模板。Git:創建一個項目框架,並讓項目基於框架

我所做的是:

git clone cheatsheet-vim cheatsheet-template 
cd cheatsheet-template 
# remove vim specific content, some additions 
cd ../cheatsheet-vim #go back to vim project 
git checkout -b testbranch #create a new branch 
git remote add template ../cheatsheet-template 
git fetch template 
git merge template/master #now I got the template project as branch in the base project 

的,現在的問題是如何讓上創建了項目本身的模板VIM-的cheatsheet項目基地。

我想擁有什麼:

  • 有模板項目,我可以改變
  • 擁有的cheatsheet,vim的項目,我可以拉canges從模板
+0

我知道源代碼不是很大,只需重新創建vim-cheatsheet並複製相關的源代碼就可以了,但我想了解真正的git方法。 – Thomas

回答

1

在你因爲你有兩個沒有共同祖先的分支,你可以嘗試和你的當前主模板/主模板('模板'是你的遠程引用模板回購的名稱)。

這是「How to merge two branches without a common ancestor?」中提出的解決方案之一。

這樣一來,兩個分支都會有一個共同的歷史,你就可以這樣做git pull --rebase當你的模板更改(重新變基上修飾獲取模板的頂部你現在的工作)


OP Thomas工具的另一種方法和commented

我結束了創建一個新的項目和複製源。

+0

感謝您的回答,但我認爲它不回答我的問題。該模板基於vim-cheatsheet,然後刪除內容。現在我想在模板上使用vim-cheatsheet。 – Thomas

+1

@Thomas「我想在模板上使用vim-cheatsheet base」:這就是「rebase --onto」會做的事情:重新應用你在vim-cheatsheet(即「基於」)模板。 – VonC

+0

我最終創建了一個新項目並複製源代碼。 – Thomas