问题
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".
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/11632566/how-to-fork-my-own-repo-into-a-new-project