πŸ“š How to Fork Your Own Repository on GitHub



This content originally appeared on DEV Community and was authored by Maria M.

🚀 Introduction

Sometimes, you need to create a copy of your own repository on GitHub to work on new features, experiments, or demos without affecting the original project. While you can’t fork your own repository directly, you can achieve a similar effect by creating a new repository and copying the content. This guide details the steps to do this.

🎯 Objective

Create a copy of your own repository on GitHub for parallel development, experimentation, or demonstrations without affecting the original project.

🛠 Steps to Fork Your Own Repository

1. Clone Your Original Repository

First, clone your original repository to your local machine.

git clone https://github.com/your-username/repository-name
cd repository-name

2. Create a New Repository on GitHub

Go to GitHub and create a new repository. Let’s name it new-repository-name.

3. Change the Remote URL to the New Repository

In your cloned repository, change the remote URL to point to the new repository.

git remote set-url origin https://github.com/your-username/new-repository-name

4. Push to the New Repository

Push the content to the new repository.

git push -u origin master

📌 Summary

  1. Clone the original repository:

    git clone https://github.com/your-username/repository-name
    cd repository-name
    
  2. Create a new repository on GitHub.

  3. Change the remote URL:

    git remote set-url origin https://github.com/your-username/new-repository-name
    
  4. Push to the new repository:

    git push -u origin master
    

📝 Conclusion

This guide provides a clear and concise way to create a copy of your own repository on GitHub, effectively “forking” it. This allows you to work on new features or experiments without affecting the original project. Use this process for parallel development, testing, and preparing demos.

Save this guide for future reference and use it whenever you need to create a copy of your repository. 😊


This content originally appeared on DEV Community and was authored by Maria M.