Git commands

Fork

In Git, a fork is a copy of a repository that allows you to freely experiment with changes without affecting the original project. A fork acts as a bridge between the original repository and your personal copy, enabling you to submit pull requests to propose changes to the original project.

Why use forks?

Forks are commonly used in open-source development to contribute to projects owned by other people or organizations. By forking a repository, you create your own copy of the project, which you can modify without affecting the original codebase. This enables you to:

  1. Propose changes: If you find a bug or want to add a new feature to a project, you can fork the repository, make your changes, and submit a pull request to the original repository. The maintainers can then review your changes and decide whether to merge them into the main project.

  2. Experiment freely: Forks allow you to experiment with new ideas or features without worrying about breaking the original project. You can make changes in your forked repository without affecting the main codebase.

  3. Collaborate with others: Forks enable collaboration among developers. You can invite other people to work on your forked repository, review your changes, and contribute their own improvements before submitting a pull request to the original project.

Many popular open-source projects have been forked and developed further by the community. Some notable examples include:

  • LibreOffice: A fork of OpenOffice, LibreOffice is a free and open-source office suite that has been extensively developed and improved by its community.

  • Jenkins: Originally a fork of the Hudson continuous integration tool, Jenkins has become a widely used open-source automation server.

  • Bitcoin Cash: A fork of the Bitcoin cryptocurrency, Bitcoin Cash was created to address scalability issues and implement different features.

Forks in Git workflows

Forks play a crucial role in Git workflows, particularly in open-source development. A typical workflow involving forks might look like this:

  1. Find a repository you want to contribute to on a platform like GitHub.
  2. Fork the repository to create your own copy.
  3. Clone your forked repository to your local machine.
  4. Create a new branch for your changes.
  5. Make your modifications and commit them to your branch.
  6. Push your changes to your forked repository.
  7. Open a pull request from your forked repository to the original repository, proposing your changes.
  8. The maintainers of the original repository review your pull request, provide feedback, and decide whether to merge your changes.

Forks vs. Branches. It's important to note that forks are different from branches. While branches are used within a single repository to manage different lines of development, forks create a separate copy of the entire repository. Forks are used for external contributions and collaboration, while branches are used for internal development and organization within a repository.

© 2024-2025 GitByBit.All rights reserved.

Hi! I'm Alex, creator of GitByBit.

And this is Gitopedia—a reference that summarizes knowledge in my Git course.

Gitopedia is designed to be a personal knowledge base. When you progress through the main Git course in VS Code, you unlock all of these topics, one by one, bit by bit. This gives you time to digest the information and gradually build the mental model of Git. Here's an example of how it works:

Learning directly in VS Code lets you practice Git exactly as you would in real life, doing real jobs, writing real code. In addition, the course has access to your actual terminal, so it can point out mistakes, suggest workarounds, etc.

The course is FREE, there are no Ads or other bullshit. There are optional premium add-ons you can purchase, mainly to support my work (regrettably, I have to eat every day), but that's totally up to you.

Learn Git in VS Code