Branching and merging

In addition to forking and pushing, branching and merging are two other processes that directly affect the GitHub repository of a given project. As the name suggests, branching is when we create an entirely separate copy of our repository, and any changes applied to this copy will not affect the main copy (also known as the master branch) or any other copies. The ability to isolate different versions of a project in one repository is significantly useful when experimental changes are made.

When committing them to GitHub, a developer can access different branches in the branch dropdown menu in the top-left corner of the GitHub web page, as shown in the following screenshot:

Branches in GitHub

On the other hand, merging is the process of combining two given branches into one, commonly between the master branch and another branch. Merging is done mainly when the developer wants to apply the changes made to a non-master branch to the master branch. This process is typically done via GitHub's online interface and is quite similar to accepting a pull request.