How To Turn A Git Branch To A Repository

01:                 ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄▄▄▄▄▄▄▄ 
02:                 ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌
03:                 ▐░█▀▀▀▀▀▀▀▀▀  ▀▀▀▀█░█▀▀▀▀  ▀▀▀▀█░█▀▀▀▀ 
04:                 ▐░▌               ▐░▌          ▐░▌     
05:                 ▐░▌ ▄▄▄▄▄▄▄▄      ▐░▌          ▐░▌     
06:                 ▐░▌▐░░░░░░░░▌     ▐░▌          ▐░▌     
07:                 ▐░▌ ▀▀▀▀▀▀█░▌     ▐░▌          ▐░▌     
08:                 ▐░▌       ▐░▌     ▐░▌          ▐░▌     
09:                 ▐░█▄▄▄▄▄▄▄█░▌ ▄▄▄▄█░█▄▄▄▄      ▐░▌     
10:                 ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌     ▐░▌     
11:                 ▀▀▀▀▀▀▀▀▀▀▀  ▀▀▀▀▀▀▀▀▀▀▀       ▀      

There are many reasons you might want to convert a branch to a repository.

For example, you might want to start a new project which has the same base as your current project.

Typically you will create a fork of the old project. However, this works if you know ahead of time that both projects will diverge going forward.

Sometimes you just don't know they will diverge so you just create a branch instead, this allows you to have a single copy of the project with the differences handled using branches.

But as your new branch begins to diverge more and more it only makes sense to just have it as a repository.

Here is how to do that.

First, you need to create a remote repository for your new project eg: On GitHub. Make sure the repository is empty, so don't add a README file or license.

Run the following command to copy the branch over to the new repository:

01: git push <remote-url> <branch_to_copy_from>:<branch_to_copy_to>

< remote-url > is the URL pointing to the new repository you created. It typically looks something like this

< branch_to_copy_from > is the name of the branch you will like to convert to a repository.

< branch_to_copy_to > will be a branch on the new repository. If you haven't created any new branches yet you can use the default branch. It's usually main or master for most Git hosting platforms.

Here is another article for you 😊 "Compile NodeJS to executable"