Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to organise git repos when building on a seed project

Tags:

git

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

like image 770
Mike Avatar asked Nov 01 '22 13:11

Mike


1 Answers

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

like image 105
onionjake Avatar answered Nov 15 '22 05:11

onionjake