How to fork my own repo into a new project?

不羁的心 提交于 2019-12-04 11:16:16

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.

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!