How do I create a new GitHub repo from a branch in an existing repo?

前端 未结 6 1416
既然无缘
既然无缘 2020-12-02 03:21

I have master and new-project branches. And now I\'d like to create a brand new repo with its master based on the new-project branch.

6条回答
  •  星月不相逢
    2020-12-02 04:08

    1. Create the NEW_REPOSITORY in github.
    2. cd OLD_REPOSITORY
    3. git push https://github.com/accountname/NEW_REPO +master:master

    And that is all. (Note: git history preserved)

    I had tried the answer above and found it not specific enough as it didn't specify +master:master which is what I needed to make it work. It works great.

    Source (with my modifications to avoid ssh issues with github): Mauricio Aiello, former Java Senior Developer, https://www.quora.com/How-do-I-create-a-new-GitHub-repository-from-a-branch-in-an-existing-repository

提交回复
热议问题