Mike
Mike

Reputation: 4259

How to organise git repos when building on a seed project

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

Upvotes: 5

Views: 590

Answers (2)

gitaarik
gitaarik

Reputation: 46300

If you want to built your OWN code INSIDE the code from the other git repo, the only way to go about it is to merge the other git repo inside yours each time.

To do this easily you can checkout the other git repo in a separate branch (or even git submodule), and merge this branch (or submodule) back in the master branch where your code is.

Upvotes: 0

onionjake
onionjake

Reputation: 4035

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).

Upvotes: 2

Related Questions