I was asking myself the same question. I'm working with Django & Flask projects mostly, which brings about endless variations (Flask/MongoDB/Vues.js etc.). I like to work with Docker as well. So I've templated the main variations that I tend to use, as Docker projects. But especially with Django, you have a few things you almost always end up doing anyways (running startproject/startapp/collectstatic).
I essentially use this answer about having different upstream for different branches of a same repo.
To start a new project, what I like to do:
- [create new directory locally]
- [create empty project repo on github]
git clone [template repo url]
git checkout -b work
git remote add project [project repo url]
git push project work
git branch -u project/work work
So essentially, I clone my template repo in my new directory. That gives me a branch master that tracks my template repo (3). Then, I immediately create a work branch (which I'll actually use for the project) (4). I add a new remote (which is my empty project's repo on github) (5). And this is key - I push project work
, which creates a first branch on the new (empty before that) project repo.
Then finally, to make that permanent, I set the branch work to track the branch work on my project's repo.(6)
Branch master already tracks branch master on the template repo, so you've nothing to do there.
Then if I'm on branch work and decide that I want to update my template, I can simply commit whatever I'm doing, switch branch to master, do the change & commit push to my template. It'll push on origin/master. Or I can wait & pile up a few minor changes to my templates, test them out & then only update the template.
If I'm far enough into the project (and thus unlikely to make further template changes), I can simply stop tracking origin/master & reconfigure the project to have a master branch, or just keep work as my master.