2012-12-13 102 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