About Branches & Forks - Carleton-SRCL/SPOT GitHub Wiki

About Branches

In Git, a branch is a parallel version of a repository's codebase. You can think of a branch as a separate timeline that allows you to work on different features or bug fixes without affecting the main codebase. When you create a branch, you essentially create a copy of the codebase at that point in time, and any changes you make to that branch are isolated from the main codebase until you merge them back in. Here is a visualization of the branch concept:

Branch concept

In GitHub, creating a branch is easy. Simply go to the repository's page, click on the "Branch" dropdown, and enter a name for your new branch. Once you create a branch, you can switch to it and start making changes. You can also merge changes from other branches into your branch, or merge your branch back into the main codebase when you're ready.

About Forks

A fork, on the other hand, is a complete copy of a repository. When you fork a repository, you create a separate copy of the entire codebase, including all of its branches and commit history. You can think of a fork as a way to create your own copy of a project that you can work on independently from the original.

Forking is often used when you want to contribute to an open-source project. By forking the project, you create a separate copy that you can work on without affecting the original project. You can make changes to your fork, push them to your own repository, and then create a pull request to ask the original project to incorporate your changes.

In GitHub, forking a repository is easy. Simply go to the repository's page, click on the "Fork" button in the top-right corner, and select where you want to fork the repository to (e.g. your personal account or an organization you belong to). Once you fork a repository, you can clone it to your local machine and start making changes.