15

I've forked the Paul Irish's HTML5 boilerplate on github so I can have my own version which better suits my needs. If I start every new web project with this boilerplate, what's the best way to get that code into a new repo? As far as I can see I've got two options:

  • Clone the repo. I don't just want to clone it, because I'm not really making changes to the boilerplate - I'm just using it as a launching-off point for a new website. Also, if I clone from github then the boilerplate repo will be setup as my remote for the new site.

  • Copy-paste the code into a new directory and start a fresh git repo there. This feels wrong somehow.

Is there a better way to handle this?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Skilldrick
  • 69,215
  • 34
  • 177
  • 229

1 Answers1

24

First, clone the skeleton repository:

git clone ssh://git@github.com/user/proj.git new_proj

Then, cd to the repo, and get rid of the origin remote:

cd new_repo
git remote rm origin

And finally, create a new remote for the project (you may want to create a new project in github first):

git remote add origin ssh://git@github.com/user/new_proj.git

Now, when you do git push origin master, it should update the new project. You will still have the history of the original project. In fact, you can rename the initial origin to projbase or some such, you can even pick up changes to your skeleton (though that could make things a bit messy in terms of merges, and rebases are frowned upon once you push to github).

vhallac
  • 13,301
  • 3
  • 25
  • 36
  • Ok, that makes sense, thanks. I think I'll steer clear of trying to pull new changes to the skeleton though! – Skilldrick Nov 04 '10 at 12:21
  • 8
    My little tweak: use `clone -o boilerplate` to name the initial remote "boilerplate" instead of "origin", so you don't have to remove it. – Cascabel Nov 04 '10 at 14:55
  • @Jefromi If you expect neither to ever pull from the boilerplate remote again, nor to push to it, what's the benefit of keeping that remote? (I realise that the answer does discuss re-pulling, but the OP didn't go for that, according to the comment.) –  May 17 '15 at 22:20
  • That was nearly 5 years ago, but if I understand myself right, I was replying to the answer and not the OP's comment; depending on how you're using this, you might well want to re-pull (or at least diff against what the remote has). – Cascabel May 18 '15 at 00:49