How to turn a git branch into fork?

本小妞迷上赌 提交于 2019-12-01 19:20:59

I guess your question is specifically: how to create a fork of your own project in the same user account in GitHub. You cannot use the user interface of the website, but you can create a new repository and push the relevant branches to it:

  1. Create new repo, completely empty, without even a README https://github.com/new

  2. Add the new repo as a new remote in your local clone of the original project, let's call this remote fork for example:

    git remote add fork NEW_REPO_URL
    
  3. Push your single-threaded branch to it:

    git push -u fork single-threaded
    
  4. Delete this branch from the original project, assuming your remote is called origin:

    git push origin :single-threaded
    

Here's how I would do it:

  1. Fork FalconUDP into a new repository (using the fork feature on GitHub)
  2. Clone the new repository (FalconUDP-st?) locally
  3. merge the single-threaded branch back into master
  4. delete the single-threaded branch
  5. push back to FalconUDP-st on GitHub

You can issue pull requests on the GitHub website, or you can just cherry pick across your local clones.

If you really want to fork, the way would be:

  1. Clone FalconUDP
  2. in the clone, checkout single-threaded branch

Now you have two options:

a) new remote repo

  1. Create new repo
  2. Add it as remote to cloned repo, call it, let's say "new-remote"
  3. git push single-threaded new-remote/master
  4. New repo has contents of single-threaded as master

b) Local repo

  1. delete branch master
  2. checkout from branch single-threaded into new branch master
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!