4

I was developing an HTML5 game engine. I used Git as the SV and GitHub to actually host the project.

I've made some substantial changes in the design (mainly switching to the Entity System paradigm), and I think it's time for a new engine.

I would like to base it off the old engine, as there is a lot of code that I can use.

What would be the standard way of doing this? The new engine will have a new name, and the old one will be considered "finished".

JJJ
  • 32,902
  • 20
  • 89
  • 102
corazza
  • 31,222
  • 37
  • 115
  • 186

2 Answers2

4

If you mean you want a new project with a new repo, but sharing history with the old one, then the simple way is

$ git clone https://github.com/your_name/old_project new_project
# make new, empty project on GitHub called new_project
$ cd new_project
$ git remote rename origin old_project
$ git remote add origin https://github.com/your_name/new_project
$ git push -u origin

Now you have a new project, but in your local clone you can still get commits from the old one to get bugfixes to common code with git cherry-pick etc.

Fred Foo
  • 355,277
  • 75
  • 744
  • 836
1

You need to branch

git branch <your_new_branch>
git checkout <your_new_branch>

to switch back to old branch

git checkout master

to list all branches

git branch
MaX
  • 1,334
  • 13
  • 26
  • I'm not sure if I should use branches for this. The new engine should be a whole new project, with its own GitHub directory. The old one is finished and I want it listed as such on my GitHub page. – corazza Jul 24 '12 at 16:27
  • for that you create a new repo on github an add its git address to remotes in ```git remote add new_repo git://github.com/foo/bar``` now onwards you can push to that repo saying ```git push new_repo your_branch```. I would recommend you doing a hardcore fork of your project if newer version is based on previous one. – MaX Jul 24 '12 at 16:38
  • What do you mean by "hardcore fork"? – corazza Jul 25 '12 at 09:09