Best approach to maintain skeleton for my projects with git

701 views Asked by At

For few years I was looking for way to manage multiple projects I'm working on. Every single one is different in some way, but the core of application in common for all. When I implemented some new features in current project, it was hard to use them in later in other project. I had to search through many projects to actually find the feature.

Then came git and it helped a lot to improve my project's management. I created one skeleton project, where the whole application structure and core libraries, tools and modules are implemented. It's a base for each new project I'm starting. It looks like this:

mkdir new_project
cd new_project
git init

Time for skeleton to merge:

git remote add skeleton git@domain:skeleton.git
git fetch skeleton
git merge skeleton/master

Now here comes project tweaking, changing ini files, adding custom templates, modules, presenters and so on. Now project lives it's own life. After some time comes merging with updated skeleton:

git fetch skeleton
git merge skeleton/master --no-commit

I like to review all changes coming from skeleton to project, therefore --no-commit option.

And now my question comes. What is the best way to maintain skeleton ? When adding new features to each project that uses skeleton as a base, there are features, that are only related to current project. But there are features to the core of application and I will need them in my next project as well, therefore I need to merge them to skeleton back.

I didn't find any way in git/merge or any other git's command to maintain skeleton. So I'm manually comparing project with skeleton (using meld, great tool though) and applying changes that are meant for skeleton, then I'm committing to skeleton.

I tried to maintain skeleton to add project as remote, fetch project and then merge to skeleton, but this way all the changes to project, that are for project only are coming back to skeleton and that is invalid.

1

There are 1 answers

4
Greg Hewgill On

One approach might be to make a new branch in your project called skeleton-improvements. When you make an improvement to the skeleton while working on a project, do it on the improvements branch. Then, merge it into your master (or working branch, whatever):

git merge skeleton-improvements

When you want to update the skeleton repo, add your project as a remote, fetch, and then merge the skeleton-improvements branch.