As an example: suppose you have a personal project like Angular Seed (which is a starting point for an Angular project https://github.com/angular/angular-seed).
Now
I found mirroring the boilerplate according to this article the only way to work for me:
Clone boilerplate and create new project:
git clone --mirror https://github.com/mxstbr/react-boilerplate.git
cd react-boilerplate.git
git remote set-url --push origin https://github.com/gitUser/newProject
Update the new project with changes from the boilerplate:
cd react-boilerplate.git
git fetch -p origin
git push --mirror
Clone the master
branch of the seed project of your choice, for example:
$ git clone -o react-starter-kit -b master --single-branch \
https://github.com/kriasoft/react-starter-kit.git MyApp
$ cd MyApp
Down the road, you can pull and merge updates from the seed project back into your local repo by running:
$ git checkout master
$ git fetch react-starter-kit
$ git merge react-starter-kit/master
$ npm install
Clone the seed project and remove its version history:
$ git clone https://github.com/kriasoft/react-starter-kit --depth=1
$ git clone https://github.com/kriasoft/react-starter-kit MyApp --depth=1
$ cd MyApp
$ rm -rf .git
Then, whenever you need to pull the latest updates from the seed project back into your local repo, you can navigate to the original seed project, pull the updates (git pull
), then compare that folder with your project's folder by using some good Diff tool (e.g. Beyond Compare) that allows you to save and customize folder comparison sessions.
I just found this answer https://stackoverflow.com/a/4096529/131227 as well as a comment (git workflow - using one repo as the basis for another) which together lead me to a solution I like.
git clone -o boilerplate ssh://git@github.com/user/proj.git new_proj
The -o boilerplate renames the origin to boilerplate
which can still be used to pull changes from.
Create your new empty github new_proj repo.
Then
git remote add origin ssh://git@github.com/user/new_proj.git
I think the right answer here is to use something like Yeoman Generators. (http://yeoman.io/) You want to use the git repo with your seed project as a generator. It wouldn't allow you to continually pull in changes from the seed project though.
The solution of using two remotes works, but eventually the projects will diverge enough that will make keeping those projects in synch very difficult.
What you could do is:
That way, your new project has:
My issue with that is that a seed project isn't a library. It doesn't live in a subdirectory of a project. It IS the project when you start, and you build from there.
Then a simple clone that you push back to your new repo is enough.
But that won't keep any "fork" relationship between your two GitHub repos.
You will have to pull one and push to the other through a local clone.