Search code examples
gitgithubsvc

How to fork my own repo into a new project?


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".


Solution

  • 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.