banner



How To Fork Your Own Repo

How to Fork a GitHub Repository – A Complete Workflow

GitHub is a great awarding that helps you manage your Git repositories. You tin also use it to contribute to the open source ecosystem and collaborate with other contributors.

Public repositories on GitHub often become lots of attention from contributors, and this helps enhance the project.

So how can you easily work on a public repo? The repository forking tool lets contributors re-create the source lawmaking repository locally and make any changes they would similar.

But if you're going to use this tool as a beginner, y'all need to sympathize the workflow of repository forking and so y'all can seamlessly work with other public repositories.

In this article, we will learn near how to fork a repo with practical examples and storytelling. If yous like to learn from video content, this commodity is as well available equally a YouTube video.

What is GitHub Repository Forking?

Suppose you love working on a particular framework or library like React.js. 1 fine twenty-four hour period, yous effigy out a manner that yous can enhance the functionality of React yourself.

React'due south source code is bachelor every bit a public repository on GitHub, so you can make a local copy of it past forking information technology.

Once you get the local re-create of the code, you can make the relevant changes and ask the React community to review your changes.

Afterwards reviewing your lawmaking changes, the React community may approve them or inquire you lot for more changes. They are most likely to have your code changes afterwards blessing.

So, let's understand the unabridged forking workflow with the story of two developers, Tom and Hari.

A Complete Forking Workflow

Tom and Hari are 2 developers who have their individual GitHub accounts. Tom is working on an outstanding project, and he manages its source code in a public repository called /tom/repo. Hari is amazed by the idea and wants to contribute to the project.

At present in that location are two ways Hari can arroyo it.

  • Hari asks Tom, "Hey Tom, I want to contribute to your projection. Could you please add me as a Contributor?". Well, Tom may or may not hold. As the project is already available as a public repository, he may just enquire to fork it and apply it.
  • The 2d manner is if Hari just forks the repo himself and starts working. He doesn't have to wait to talk to Tom and get Tom to add him as a contributor specifically.

This second approach of forking a repository directly is more convenient for whatsoever contributor. So how does it work? Let'southward empathize the workflow in steps.

  1. Hari forks the repository /tom/repo. Nosotros call the /tom/repo repository the Upstream Repository.
  2. The repository is now available in Hari's GitHub account as /hari/repo. We call the hari/repo the Forked Repository. Too, it is an exact copy of the upstream repository. This repository is entirely detached from Tom'southward repo and Hari can start making any changes he wants. Hari will first clone the repository and start making changes to practice that.
  3. Hari makes the required changes and pushes the changes to the forked repository.
  4. Finally, Hari creates a Pull Request from the forked repository to the upstream repository. Tom reviews the pull request at his convenience to corroborate and merge it if all goes well.

That's the entire workflow—simple and straightforward ways to contribute to the public repository. A picture is worth thousands of words. Here is a sit-in of the workflow we discussed.

GitHub-Fork
Workflow - Forking a Repository

How to Fork a Repo in GitHub

Forking a repository is the matter of clicking a push button.

To follow along, browse to a public repository that you want to fork. At the height correct of the page, you lot will find the Fork push button. Click on the button and wait for a few seconds. You will run into that the newly forked repository gets created nether your GitHub account.

image-29
Fork Push

Follow the steps we learned above after forking the repository to get-go contributing.

Let's Practice Forking

As a newbie, do you want to practice forking to be more confident? Let's do that. Yous can perform these tasks to practice forking.

  • Scan to this public repository: https://github.com/atapas/fork-me
  • Create a folder with the aforementioned name every bit your GitHub user-id (it is atapas for me).
  • Add together a Readme.md file inside the folder with any text of your choice.
  • Create a Pull Request upstream. I shall review and merge it if all is well.

Don't worry if y'all go incorrect. Go on trying, you lot volition get it. It will exist like a practice playground of contributing to an open-source repository.

In Summary

  • Git is a version control tool widely used by the developer community. If y'all are a beginner to Git, acquire about it from here.
  • GitHub is a pop application for managing Git repositories. Anyone can contribute to a public repository.
  • Forking is an first-class tool for copying source code from someone's repository to your repository and contributing to it.
  • The forking workflow is uncomplicated to learn and get started.

Before We Finish...

I hope yous found the commodity helpful. Please practise forking and contribute to open up source projects. My DMs are open on Twitter if y'all want to discuss further.

Let'southward connect. I share my learnings on JavaScript, Web Development, Career, and Blogging on these platforms as well:

  • Follow me on Twitter
  • Subscribe to my YouTube Channel
  • Side projects on GitHub

Encounter y'all soon with my next commodity. Until then, please take care of yourself, and stay happy.



Learn to code for free. freeCodeCamp'due south open source curriculum has helped more than than 40,000 people get jobs as developers. Get started

Source: https://www.freecodecamp.org/news/how-to-fork-a-github-repository/

0 Response to "How To Fork Your Own Repo"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel