tags:

views:

83

answers:

3

In order to get a new django project up and running faster, I'd like to maintain a separate "project skeleton" on which I base all my new projects. It would be great if, as I improved the skeleton, I could bring those improvements into my active projects. How can I accomplish this with git?

So, maybe in my remote git repository machine I would have 1 repo for each project and one for the skeleton?

  • proj-A-repo
  • proj-B-repo
  • skeleton-repo

If I want to create a new proj-C locally based on the skeleton, then push my local changes up to the remote server in a new repo called proj-C-repo, how might I do this?

I've read through quite a bit of git documentation, but I'm confused about how to go about this. Do I need to clone the skeleton, or create an empty repo and then track a remote branch, or something else?

A: 

You could do the following:

Create a Git repo that is your skeleton and add the stuff that's in A and B repo to your .gitignore. Then init new git repositories in A and B location and push to there.

That way you end up with:

skeleton
 +---> .git
 +---> project A
     +-----> .git
 +---> project B
     +-----> .git

I just tried this and it worked having a git repo inside a git repo, as long as you add the subrepo to the .gitignore..

Tigraine
It strikes me as a little odd to have projects "contained" in the skeleton.
Marcelo Cantos
I think the general idea was to have the skeleton be it's own project that is re-useable with other projects. So having them share parts of their history is not really good since you'd have to cherry-pick all changes back to the skeleton.. But cherry-picking would also work
Tigraine
+3  A: 

This is exactly what git (or any DVCS) is good at. Give the skeleton its own repo; to create a new project you'd typically clone the skeleton onto your workstation, work away, then push to a different location (e.g. myserver:repo-C). If you later improve the skeleton and push changes to it, you can work them into an existing project with git pull myserver:skeleton and then merging.

crazyscot
That's exactly what I was looking for. Thanks a million.
asciitaxi
A: 

You can find a good example of project skeleton with this sbt console template

If you clone it and launch sbt, you will get a fully functional Scala project:

  • which can be compiled, executed, tested and even eclipsified (to be imported as an eclipse project)!.
  • which can be stored in a Git repo of its own, with .gitignore already configured.
VonC