在种子项目上构建时如何组织git回购 [英] How to organise git repos when building on a seed project

查看:87
本文介绍了在种子项目上构建时如何组织git回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个基于我从github克隆的种子项目(MEAN.io)的网站。我如何将这些文件与我自己的文件分开。由于这个种子提供了广泛的文件框架,我自己的文件分布在整个项目中。我希望能够从种子中获取更新,但不能将它与我正在添加的文件混合。



我知道我可以将种子添加为git子模块,但我如何保留我的文件,我添加在这个目录远离种子回购?



干杯

解决方案

将您的文件提交给分支

  $ git clone https://github.com/linnovate/mean.git myproject 
$ cd myproject
$ git分支myproject#创建myproject分支
$ git checkout myproject#切换到该分支
$ echo仅用于我的项目的文件> myfile
$ git commit myfile -m为我的项目添加文件

全部您的更改将独立于种子项目。如果您想了解最新的信息并查看种子项目的所有位置,请执行以下操作:

  $ git checkout master 
$ git pull

现在您的所有文件都将消失,您将看到什么MEAN中最新的东西看起来像。如果你希望你的项目得到他们的改变,你可以这样做:

  $ git checkout myproject 
$ git merge master

当然有很多方法可以做到这一点(搜索追踪分支) p>

如果您打算在项目中使用MEAN.io作为子目录,所有这些仍然适用(仅在子模块中)。


I am building a site based on an seed project (MEAN.io) which I cloned from github. How do I separate these files from my own files. As this seed gives a wide skeleton of files, my own files are distributed across the project. I would like to be able to pull updates from the seed, but not mix it with the files I am adding.

I know I can add the seed as a git submodule, but how do I keep my files that I add in this directory away from the seed repo?

Cheers

解决方案

Commit your files to a branch.

$ git clone https://github.com/linnovate/mean.git myproject
$ cd myproject
$ git branch myproject   # create myproject branch
$ git checkout myproject # switch to that branch
$ echo "A File for just my project" > myfile
$ git commit myfile -m "Adding a file just for my project"

All of your changes will be independent from the seed project. If you want to keep up to date and see where the seed project is all you need to do is this:

$ git checkout master
$ git pull

Now all of your files will be gone and you will see what the latest stuff in MEAN looks like. If you wish for your project to get their changes you would do this:

$ git checkout myproject
$ git merge master

Of course there are a ton of ways to do this (search for tracking branches).

If you intend to use MEAN.io as a subdirectory in your project all of this still applies (just within the submodule).

这篇关于在种子项目上构建时如何组织git回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆